Re: class member types
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 04/01/04
- Next message: Victor Bazarov: "Re: Difference between DEBUG and NDEBUG?"
- Previous message: Leor Zolman: "Re: "NULL" iterator"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 01 Apr 2004 02:32:45 GMT
"nospam" <johnnynoname_1@hotmail.com> wrote...
> If i have some code like this:
>
> template<typename T>
> class eg
> {
> public:
> typedef T size_type;
> ...
> void somefunc(size_type);
> };
>
> What would be the correct way to define this
> member function outside of the class definition?
>
> template<typename T>
> void eg<T>::somefunc(size_type)
> {}
>
> The above code compiles, but is it correct?
Yes. Parameter types are look up in the scope of the class for
which you define the member. Since you've already written
'eg<T>' once (just before the '::'), you don't need to write it
again.
> Or do i need to do something like:
>
> template<typename T>
> void eg<T>::somefunc(typename eg<T>::size_type)
> {}
Shouldn't have to.
Victor
- Next message: Victor Bazarov: "Re: Difference between DEBUG and NDEBUG?"
- Previous message: Leor Zolman: "Re: "NULL" iterator"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|