Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Templates: ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 9444 of 10094
Post > Topic >>

Re: Templates: default template argument in a friend class template declaration

by =?ISO-8859-1?Q?Daniel_Kr=FCgler?= <daniel.kruegler@[EMAIL PROTECTED] Mar 31, 2008 at 03:30 AM

On 31 Mrz., 00:59, Oncaphillis <oncaphil...@[EMAIL PROTECTED]
> wrote:
> But this
> <snip>
>
> template<class T, int i> class Vector {
>
> };
>
> class vector_fr
> {
>          template <class S, int i=56> friend class Vector;
>
> };
>
> int main() {
>         Vector<char> v;
> }
>
> </snip>
>
> compiles. I guess "shall not" can always be replaced by
> "shall not but can" in the standard. Which value for
> i is taken if you instantiate Vector<T> ?.

If this compiles, the compiler is not in full std-compliance
mode ;-).

The corresponding paragraph ([temp.param]/9) is quite
clear and has not been changed in this part (It has been
extended to take the new default template arguments of
function templates into account, but that's all).

"Shall" does not give any freedom to interpret the requirement
in a relaxed form, it is strictly "binding". And I don't understand,
how gcc does come to the conclusion that your code-example
is well-formed. I have the impression that it only checks the
def-arguments-shall-not-be-repeated rule ([temp.param]/12),
which could be applied to Bharath's example, but not to yours.

Greetings from Bremen,

Daniel Krügler



-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 1 Posts in Topic:
Re: Templates: default template argument in a friend class templ
=?ISO-8859-1?Q?Daniel_Kr=  2008-03-31 03:30:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 7:58:02 CDT 2008.