class member types

From: nospam (johnnynoname_1_at_hotmail.com)
Date: 03/31/04


Date: 31 Mar 2004 08:13:52 -0800

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?
Or do i need to do something like:

template<typename T>
void eg<T>::somefunc(typename eg<T>::size_type)
{}

Thanks



Relevant Pages

  • Re: Global var in Balance calculation
    ... typedef enum observations ... typedef struct card ... PtrCrt p_cartao; ... void Insert_Card; ...
    (comp.lang.c)
  • Re: void func () returning value?
    ... this feature can be extremely useful. ... T foo() {... ... In at some point in the future I might decide to change the typedef to ... void" would solve the problem in a very elegant way. ...
    (comp.lang.c)
  • Re: Pointers to functions
    ... Prefix it with typedef and place parentheses round the ... typedef void (int, char const *); ... However you cannot have an array of foo_type because you are not allowed ...
    (alt.comp.lang.learn.c-cpp)
  • Re: End-of-the-week fun
    ... but anyway) Typedef names for function types can be used to declare both ... typedef void VVF(); ... This typedef-name cannot be used to declare non-member functions. ... // The initializer expression has type 'void ' and it points ...
    (comp.lang.cpp)
  • Re: Can C# Call This DLL?
    ... >I need to call a Win32 DLL. ... The API supports both Windows and Linux, but> I'm only concerned with Windows. ... > There are many "typedef" and "typedef struct" statements with char, const, ... > (void * Memblock, ...
    (microsoft.public.vc.language)