By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,388 Members | 1,791 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,388 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

Jul 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.