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

Sepplesfags, help!

Name: Anonymous 2008-12-08 18:34


template <class T>
class A
{
public:
    typedef T Foo;
};

template <class T>
class B
{
    A<T>::Foo foo;
};

int main()
{
    B<int> b;
    return 0;
}



test.cpp:11: error: type ‘A<T>’ is not derived from type ‘B<T>’
test.cpp:11: error: expected ‘;’ before ‘foo’


What the FUCK?

Name: Anonymous 2008-12-10 9:54

cocks

Name: Anonymous 2008-12-10 11:05

Sepplecocks

Name: Anonymous 2008-12-10 11:10

cockles and mussels

Name: Anonymous 2008-12-10 11:15

"COx" like Alan Cox. Coincidence?

Name: Anonymous 2008-12-10 11:41

Anonymous (2008). Sepples Considered Harmful. 4chan Journal of /prog/ramming, Internets.

Name: Anonymous 2009-11-30 1:05

>>25
I have ruminated for a while before posting, and I have decided that the following is ambiguous without typename:

T::id();

Is that constructing a temporary value of type T::id, or calling a static member function T::id? Bear in mind that the compiler doesn't know what T is at this point, so it can't just look at T and decide.

Name: Anonymous 2009-11-30 2:39

>>46
A compiler could still resolve that at instantiation time.  The only problem is that some constructions would force it to generate several alternative parse trees, making sepples compilation even slower.

Name: Anonymous 2009-11-30 2:49

>>23
To be fair, it's only pig shit GCC that bitches about this. MSVC is actually sane about parsing it. I had uhh... let me remember.

for (vector<T>::iterator iter = vec.begin(); iter != vec.end(); ++iter)

MSVC took it like a champ and then GCC whined like the little shitty schoolgirl bitch that it is.

The solution was not vector<typename T> as you might expect, either. It was typename vector<T>. I should be angry at the standard, but seriously, this should BE the standard.

Name: Anonymous 2009-11-30 2:55

>>46
The compiler should complain in the event that it cannot effectively choose. It shouldn't complain in instances where it can (the majority).

Name: Anonymous 2009-11-30 2:58

>>48
It's not vector<typename T> because we’re not telling the compiler that T is a type; we are hinting to the compiler that vector<T>::iterator is a type.

Name: Anonymous 2009-11-30 2:59

>>48
The solution was not vector<typename T> as you might expect, either. It was typename vector<T>. I should be angry at the standard, but seriously, this should BE the standard.
Why would you expect that?  Of course T is a type, you just declared it that way.  But vector<T>::iterator could be anything, so you need to clarify it.

Name: Anonymous 2009-11-30 3:05

Even better, mixing the template keyword in:

typedef typename _Alloc::template rebind<_List_node<_Tp> >::other _Node_alloc_type;

Name: Anonymous 2009-11-30 4:15

>>51
That's why MSVC has a perfect resolution of my intent. Because I need to clarify it.

Name: Anonymous 2010-12-10 0:37

Name: Anonymous 2010-12-17 1:39

FOLLOW THE NEW GNAA TWITTER AT http://twitter.com/Gary_Niger

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