need for typedef for instances of template classes

Discussion in 'C++' started by puzzlecracker, Sep 16, 2005.

  1. In Sutter's book - More Exceptional C++, on page 27 - there is

    typedef IsDerivedFrom1<t, Cloanable > Y;

    where he specifies that "typedef is needed it otherwise the , will be
    interpeted as delimiting macro parameters to assert.

    assert(Y:Is);

    etc...

    why would it be interpetted this way? if that the case, typename is
    need. someone please explain
     
    puzzlecracker, Sep 16, 2005
    #1
    1. Advertising

  2. puzzlecracker wrote:
    > In Sutter's book - More Exceptional C++, on page 27 - there is
    >
    > typedef IsDerivedFrom1<t, Cloanable > Y;
    >
    > where he specifies that "typedef is needed it otherwise the , will be
    > interpeted as delimiting macro parameters to assert.
    >
    > assert(Y:Is);
    >
    > etc...
    >
    > why would it be interpetted this way? if that the case, typename is
    > need. someone please explain
    >


    In

    assert(IsDerivedFrom1<t, Cloanable >::Is);

    The comma is indeed interpreted as seperating two macro parameters. This
    is because macro substitution is done before anything else (more or less).

    Not sure why you think typename is also needed, that would depend on the
    context.

    john
     
    John Harrison, Sep 16, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Wohlbier
    Replies:
    2
    Views:
    391
    Josiah Carlson
    Feb 22, 2004
  2. aaragon
    Replies:
    12
    Views:
    1,322
    aaragon
    Nov 8, 2006
  3. Adam Nielsen
    Replies:
    3
    Views:
    424
  4. oor
    Replies:
    0
    Views:
    1,398
  5. Replies:
    8
    Views:
    482
    James Stroud
    Jan 29, 2009
Loading...

Share This Page