deduce element type of c-array template argument

Discussion in 'C++' started by Maik, Dec 3, 2008.

  1. Maik

    Maik Guest

    Hi,

    What is ?? in
    <code>
    template< typename T >
    struct element_type
    {
    typedef ?? type;
    };
    <code>
    so that i.e
    boost::is_same<element_type<float[3]>::type, float>::value
    is true?

    Thanks in advance,
    -- Maik
     
    Maik, Dec 3, 2008
    #1
    1. Advertising

  2. On Dec 3, 4:58 pm, Maik <> wrote:
    > Hi,
    >
    > What is ?? in
    > <code>
    >   template< typename T >
    >   struct element_type
    >   {
    >     typedef ?? type;
    >   };
    > <code>
    > so that i.e
    >   boost::is_same<element_type<float[3]>::type, float>::value
    > is true?
    >
    > Thanks in advance,
    >  -- Maik


    template <typename T>
    struct element_type;

    template <typename T, size_t N>
    struct element_type <T [N]>
    {
    typedef T type;
    };

    Regards,
    Vidar Hasfjord
     
    Vidar Hasfjord, Dec 3, 2008
    #2
    1. Advertising

  3. Maik

    Maik Guest

    On 3 Dez., 18:29, Vidar Hasfjord <> wrote:
    > On Dec 3, 4:58 pm, Maik <> wrote:
    >
    >
    >
    > > Hi,

    >
    > > What is ?? in
    > > <code>
    > >   template< typename T >
    > >   struct element_type
    > >   {
    > >     typedef ?? type;
    > >   };
    > > <code>
    > > so that i.e
    > >   boost::is_same<element_type<float[3]>::type, float>::value
    > > is true?

    >
    > > Thanks in advance,
    > >  -- Maik

    >
    > template <typename T>
    > struct element_type;
    >
    > template <typename T, size_t N>
    > struct element_type <T [N]>
    > {
    >   typedef T type;
    >
    > };
    >
    > Regards,
    > Vidar Hasfjord


    Thank you!

    -- Maik
     
    Maik, Dec 3, 2008
    #3
    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. Replies:
    7
    Views:
    561
  2. George2

    template function argument deduce

    George2, Mar 11, 2008, in forum: C Programming
    Replies:
    0
    Views:
    407
    George2
    Mar 11, 2008
  3. Ed
    Replies:
    1
    Views:
    409
    James Kanze
    Aug 14, 2008
  4. nguillot
    Replies:
    5
    Views:
    563
  5. Nephi Immortal
    Replies:
    0
    Views:
    232
    Nephi Immortal
    Jan 26, 2013
Loading...

Share This Page