User forums > Help

Templated friend function + gcc = hell

<< < (2/2)

FocusedWolf:
Thx everyone! ... other websites explained to put the implementation on the bottom (but they were using vs i think)...once i did it like your examples, (which works in vs to!) everything worked out great :D


You know what would be good is if someone made a addin for vs.net that added gcc into it. It'd be possible to cause of how extensible vs is,...you can write your own language even with vs having the options to make projects for it and stuff...i wonder if anyone did this already.

Another way, just for the sake of testing if your code was following ansi, would be to write a syntax checker addin...do any of you even uses vs? maybe it's dumb to talk of such things in a codeblocks forum :P

Edit:

Hmm this is intersting: http://msdn.microsoft.com/chats/transcripts/vstudio/vstudio_022703.aspx

says that next vs.net will be 98% comformant to iso standards, or something like that

FocusedWolf:
Doh!

template <class Type>
void SomeThing<Type>::Remove(const Type & data = Type())
{}

template <class Type>
class Something
{
   public:
   
        Something()
        {}
       
        void Remove(const Type & data = Type());
};

int main()
{
   return 0;
}

it looks like if i take out where i do " = Type()" that i get some errors...(works in vs).

Is this not permitted anymore in in gcc?

Ceniza:
You should put " = Type()" only in the definition and remove it in the declaration. In other words, it should be specified once and only in the definition.

Try this:


--- Code: ---template <class Type>
class Something
{
   public:

        Something()
        {}

        void Remove(const Type & data = Type());
};

template <class Type>
void Something<Type>::Remove(const Type & data)
{}

int main()
{
   return 0;
}
--- End code ---

FocusedWolf:
Thx! vs.net really lets people get away with to much :? ...if it weren't for the cool appearence i probably wouldn't even use it...

Navigation

[0] Message Index

[*] Previous page

Go to full version