>> I'm trying to create a template function to convert from a vector of
>> Es, to a managed array of Es. I want this to work with std::vector,
[quoted text clipped - 5 lines]
>
> template<template<class> T, typename E>
Err...
template<template<typename> class T, typename E>
HOWEVER, that won't work for std::vector. Sadly, the C++ standarization
committee made the regretable decision (IMO) to require template argument
lists for template template parameters to match exactly, rather than
requiring them to be compatible.
The template argument list for std::vector isn't simply <T>, rather, it's at
least <T,std::allocator<T> >. More unfortunately, implementors are allowed
to add additional template parameters with defaults, so in practice it's
impossible to match a standard container such as std::vector to a template
template argument in a portable way.
-cd
ben - 03 Mar 2005 10:44 GMT
would this work?
template <typename E, typename Policy = DefPolicy<E> >
class CToManaged
{
public:
E operator () (const typename Policy::ContainerType& crUnmanagedVec)
__gc[];
};
template <typename E>
class DefPolicy
{
public:
typedef std::vector<E> ContainerType;
//...
};
ben
> >> I'm trying to create a template function to convert from a vector of
> >> Es, to a managed array of Es. I want this to work with std::vector,
[quoted text clipped - 22 lines]
>
> -cd