template #9

  • Follow


template<>
typename basic_trait<std::vector<float> >::Basic
DataRef<std::vector<float> >::operator[](std::size_t index) const;

Hi
with the above i get error:
using =91typename=92 outside of template
Any help? Also I don't understand typename.
Thanks
0
Reply bxcvs (3) 6/6/2011 6:47:34 AM

On Sun, 05 Jun 2011 23:47:34 -0700, bx wrote:

> template<>
> typename basic_trait<std::vector<float> >::Basic
> DataRef<std::vector<float> >::operator[](std::size_t index) const;
> 
> Hi
> with the above i get error:
> using ‘typename’ outside of template Any help? Also I don't understand
> typename. Thanks

This is a VERY basic template question.  Where did you lift this from.  it looks like a specialization
of an existing genralized template...and yes typename (or class) has to be within the angle brackets.

Ruben
0
Reply ruben9526 (133) 6/6/2011 8:22:14 AM


sure most basic but what does that look like? I only get errors
whatever i try...
0
Reply bxcvs (3) 6/6/2011 10:02:10 AM

On 06/06/2011 06:02 AM, bx wrote:
> sure most basic but what does that look like? I only get errors
> whatever i try...


Did you try reading about them before you did whatever your trying to 
do.  The question is so fundamental that one can't begin to answer it 
without writing a text book.


0
Reply ruben9526 (133) 6/6/2011 10:05:19 AM

bx wrote:
> template<>
> typename basic_trait<std::vector<float> >::Basic
> DataRef<std::vector<float> >::operator[](std::size_t index) const;
>
> Hi
> with the above i get error:
> using �typename� outside of template
> Any help? Also I don't understand typename.
> Thanks

typename is currently only allowed when actually needed. As there are 
no template parameters in "basic_trait<std::vector<float> >::Basic", 
this is just an ordinary type, and typename is not needed.


In the upcoming C++11 these rules are somewhat relaxed.


Bo Persson
 


0
Reply bop (1069) 6/6/2011 10:17:31 AM

Thanks...now much more to learn...
0
Reply Michael106 (11) 6/6/2011 4:21:15 PM

5 Replies
43 Views

(page loaded in 0.724 seconds)


Reply: