Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ template help?

Name: Anonymous 2007-02-04 0:44

In the following program I want g() to be prototyped inside the class X and defined later.  I can't get g() to compile though no matter how many variations I try.  f() compiles fine.

template <typename T>
class X
{
public:
    class Y { };
    Y f() {Y y; return y;} //Okay function.
    Y g(); //Problematic function.
};

//Compiler Error Here: expected constructor, destructor, or type conversion before 'X'
template <typename T>
X<T>::Y X<T>::f()
{
    Y y;
    return y;
}


int main()
{
    X<int> x;
    x.f(); //This works.
    x.g(); //Call to problematic function.
}

Name: Anonymous 2007-02-05 14:24

>>9
According to your definition, Lisp is the only dynamic language. Way to go. By the way, what does Paul Graham's cock taste like?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List