Re: templating
- From: Bernd Robertz <bernd robertz cssweb de>
- To: Fabrício Godoy <skarllot gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: templating
- Date: Sun, 21 Dec 2008 18:23:34 +0100
Hi,
good idea, but that implies also a method for setting the parameter in
the (i. e.) tClass.
Or don't?
Bernd
Am Sonntag, den 21.12.2008, 13:20 -0200 schrieb Fabrício Godoy:
> I think that you need create a third class, as:
>
> class tClassEmpty : tClass {
> tClassEmpty() : tClass("") { .. };
> ...
> }
>
> class myNodeClass : NodeTree<tClassEmpty> {
> ...
>
> 2008/12/21 Robert Rehammar <robert rehammar se>
> Hi all,
>
> I'm writing a small program and has bumped in to a problem. It
> is
> probably actually C++ related, but since it should be a
> problem lot's of
> people here face I'll ask here. I want to do the following:
>
> class tClass {
> tClass (string s) {...};
> ...
> }
>
> class myNodeClass : NodeTree<tClass> {
> myNodeClass (string s) :
> NodeTree<tClass> {
> ...
> };
> }
>
> But this won't compile as the template for NodeTree, tClass,
> requires a
> parameter (the string s) and I simply can't figure out how to
> pass it to
> the template.
>
> Writing the constructor as
>
> myNodeTree (string s): NodeTree<tClass (s)> won't compile,
> complaining
> that s can't appear in a constant expression, so this seem so
> suggest
> that I can't template with a class that require any parameters
> for
> initiation...
>
> Thanks in advance!
>
> \\Robert Rehammar
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]