template template parameters with a default - build error that oncedid not occur (new gcc?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • er

    template template parameters with a default - build error that oncedid not occur (new gcc?)

    Hi all,

    I have some build errors related to template templates that once
    compiled fine, but not anymore. i'm guessing this might be due to an
    upgrade in gcc (i upgraded from ubuntu 7.10 to 8.04).

    suppose i have a template class like this:

    template<typena me ValueType,templ ate<typenamecla ss F>
    struct A{
    typedef F<ValueTypef_ty pe;
    };

    and in a source file I have:

    typedef A<ValueType,std ::vectora_type;

    This used to work fine, not anymore:

    expected a template of type ‘template<class class F’, got
    ‘template<class _Tp, class _Allocclass std::vector’

    I understand this error message, it's just that _Alloc usually has a
    default, which previously allowed the definition of A as above, not
    anymore! I have to refactor my code, any suggestion?

    Thanks!
  • er

    #2
    Re: template template parameters with a default - build error thatonce did not occur (new gcc?)

    On Aug 24, 4:41 pm, er <erwann.rog...@ gmail.comwrote:
    Hi all,
    >
    I have some build errors related to template templates that once
    compiled fine, but not anymore. i'm guessing this might be due to an
    upgrade in gcc (i upgraded from ubuntu 7.10 to 8.04).
    >
    suppose i have a template class like this:
    >
    template<typena me ValueType,templ ate<typenamecla ss F>
    struct A{
      typedef F<ValueTypef_ty pe;
    >
    };
    >
    and in a source file I have:
    >
    typedef A<ValueType,std ::vectora_type;
    >
    This used to work fine, not anymore:
    >
    expected a template of type ‘template<class class F’, got
    ‘template<class _Tp, class _Allocclass std::vector’
    >
    I  understand this error message, it's just that _Alloc usually has a
    default, which previously allowed the definition of A as above, not
    anymore! I have to refactor my code, any suggestion?
    >
    Thanks!
    ps: i believe I'm using gcc 4.2.3

    Comment

    • Ian Collins

      #3
      Re: template template parameters with a default - build error thatonce did not occur (new gcc?)

      er wrote:
      Hi all,
      >
      I have some build errors related to template templates that once
      compiled fine, but not anymore. i'm guessing this might be due to an
      upgrade in gcc (i upgraded from ubuntu 7.10 to 8.04).
      >
      suppose i have a template class like this:
      >
      template<typena me ValueType,templ ate<typenamecla ss F>
      struct A{
      typedef F<ValueTypef_ty pe;
      };
      >
      and in a source file I have:
      >
      typedef A<ValueType,std ::vectora_type;
      >
      This used to work fine, not anymore:
      >
      expected a template of type ‘template<class class F’, got
      ‘template<class _Tp, class _Allocclass std::vector’
      >
      I understand this error message, it's just that _Alloc usually has a
      default, which previously allowed the definition of A as above, not
      anymore! I have to refactor my code, any suggestion?
      >
      Bite the bullet and change it! The latest C++ 0x draft standard says
      explicitly that default arguments are not considered.

      You'll want something like:

      template<typena me V,template<type name E,
      typename A = std::allocator< E class F>

      --
      Ian Collins.

      Comment

      • er

        #4
        Re: template template parameters with a default - build error thatonce did not occur (new gcc?)

        On Aug 25, 1:22 am, Ian Collins <ian-n...@hotmail.co mwrote:
        er wrote:
        Hi all,
        >
        I have some build errors related to template templates that once
        compiled fine, but not anymore. i'm guessing this might be due to an
        upgrade in gcc (i upgraded from ubuntu 7.10 to 8.04).
        >
        suppose i have a template class like this:
        >
        template<typena me ValueType,templ ate<typenamecla ss F>
        struct A{
          typedef F<ValueTypef_ty pe;
        };
        >
        and in a source file I have:
        >
        typedef A<ValueType,std ::vectora_type;
        >
        This used to work fine, not anymore:
        >
        expected a template of type ‘template<class class F’, got
        ‘template<class _Tp, class _Allocclass std::vector’
        >
        I  understand this error message, it's just that _Alloc usually has a
        default, which previously allowed the definition of A as above, not
        anymore! I have to refactor my code, any suggestion?
        >
        Bite the bullet and change it!  The latest C++ 0x draft standard says
        explicitly that default arguments are not considered.
        >
        You'll want something like:
        >
        template<typena me V,template<type name E,
                                     typename A =std::allocator <E class F>
        >
        --
        Ian Collins.
        OK, thanks!

        Comment

        Working...