friend template doesn't work for MS VC 7.1 ?!

O

Oliver Kowalke

Hi,

following code will not compile with MS VC 7.1:

struct null_type;

template< bool B, typename T, typename E >
struct if_then_else;

template< typename T, typename E >
struct if_then_else< true, T, E >
{
typedef T result_type;
};

template< typename T, typename E >
struct if_then_else< false T, E >
{
typedef E result_type;
};

template< int N >
class A
{
private:
template< int M >
class X
{
typedef typename if_then_else< N <= M, A< M >, null_type >::result_type
result_type;
};

template< int M >
friend typename A< N >::X< M >::result_type;
//friend typename A::X< M >::result_type;
};

only such A< M > should become friends of A< N > if N <= M. but it doesn't
compile :^(
why?
thx,
Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,173
Latest member
GeraldReund
Top