
On 07/08/2004 05:40 PM, Jonathan Turkanis wrote: [snip]
Got it. One last try -- a variation on Brian's:
struct nested_base { };
template <class P1, class P2> struct sp { template <typename T> struct nested : nested_base { typedef P1 p1; typedef P1 p2; typedef T t; }; };
template <typename T, typename Enabler = void> struct less { };
template<typename T> struct enable_if_nested : boost::enable_if< boost::is_base_and_derived<nested_base, T> > { };
template <typename T> struct less< T, typename enable_if_nested<T>::type > { ... };
There's another related problem which David might face, templated CTOR's. As I understand (from previous emails from David), P1 and P2 are policies and the T is the referent in a smart pointer. For any S which is a subtype of T, then the nested class would probably have: template <typename T> struct nested { template < typename S //subtype of T' > nested(sp<P1,P2>::nested<S>& a_sp) ; }; Now both P1 and P2 are in a non-deduced context and, AFAICT, there no workaround using some helper class like the above nested_base or Brian's i_am_a_nested_thingy. Maybe I'm wrong. If so, could someone please outline a solution? TIA.