Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-08-30 16:36:18


Gary Powell writes:
> This works for one additional class type. How about three?
> template<class Compare, class Equal, class Allocator>
> struct garys_contianerS {};
>
> template<class Compare, class Equal, class Allocator, class T>
> struct container_gen<garys_containerS<Compare,Equal,Allocator>, T>
> {
> typedef garys_container<T, Compare<T>, Equal<T>, Allocator> type;
> };
>
> I think this is prohibited. Its fine for the namespace ggcl, but not std.

If you want to use template template parameters in the selectors
that's your own business ;)

namespace gary {
  template< template <class T> class Compare,
            template <class T> class Equal,
            class Allocator>
  struct contianerS {};
}
namespace std {
  template<class Compare, class Equal, class Allocator, class T>
  struct container_gen<gary::containerS<Compare,Equal,Allocator>, T>
  {
    typedef gary::container<T, Compare<T>, Equal<T>, Allocator> type;
  };
}

This should work just fine, and I don't think there is a std namespace
problem:

17.4.3.1 "... A program may add template specializations for any
standard library template to namespace std. Such a specialization
(complete or partial) of a standard library template results in
undefined behaviour unless the declaration depnds on a user-defined
name of external linakage and unless the specialization meets the
standard library requirements for the original template"

Cheers,

Jeremy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk