David Abrahams <[EMAIL PROTECTED]> writes:

> I'm looking at it to see if I can find a way to get has_rebind<T> to
> work without instantiating T.

Well, I did it, but although it passes my local tests it seems to
fail for your example.  I'm not sure what to tell you; the patch is
below:

Index: boost/mpl/aux_/has_rebind.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/mpl/aux_/has_rebind.hpp,v
retrieving revision 1.8
diff -w -u -r1.8 has_rebind.hpp
--- boost/mpl/aux_/has_rebind.hpp       25 Feb 2003 23:10:54 -0000      1.8
+++ boost/mpl/aux_/has_rebind.hpp       30 Mar 2003 21:46:07 -0000
@@ -17,6 +17,9 @@
 #ifndef BOOST_MPL_AUX_HAS_REBIND_HPP_INCLUDED
 #define BOOST_MPL_AUX_HAS_REBIND_HPP_INCLUDED
 
+#include <boost/config.hpp>
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 #include "boost/mpl/aux_/has_xxx.hpp"
 #include "boost/mpl/if.hpp"
 #include "boost/mpl/bool.hpp"
@@ -37,5 +40,33 @@
 };
 
 }}}
+
+#else
+
+# include <boost/mpl/bool.hpp>
+# include <boost/mpl/aux_/yes_no.hpp>
+# include <boost/mpl/aux_/type_wrapper.hpp>
+
+namespace boost { namespace mpl { namespace aux {
+
+no_tag has_rebind_test(...);
+
+template <class T>
+struct rebind_base
+{
+    friend yes_tag has_rebind_test(T);
+};
+
+template <class T>
+struct has_rebind
+ {
+     typedef type_wrapper<T> wrapper;
+     BOOST_STATIC_CONSTANT(bool, value = sizeof(aux::has_rebind_test(wrapper())) == 
sizeof(yes_tag));
+     typedef bool_<value> type;
+ };
+
+}}}
+
+#endif
 
 #endif // BOOST_MPL_AUX_HAS_REBIND_HPP_INCLUDED
Index: boost/mpl/aux_/lambda_support.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/mpl/aux_/lambda_support.hpp,v
retrieving revision 1.9
diff -w -u -r1.9 lambda_support.hpp
--- boost/mpl/aux_/lambda_support.hpp   7 Mar 2003 11:38:59 -0000       1.9
+++ boost/mpl/aux_/lambda_support.hpp   30 Mar 2003 21:46:07 -0000
@@ -104,16 +104,22 @@
 /**/
 
 #   if !defined(__BORLANDC__)
+
+#   include <boost/mpl/aux_/has_rebind.hpp>
+
 #   define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \
     BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(i, name, params) \
 }; \
-class BOOST_PP_CAT(name,_rebind) \
+    class BOOST_PP_CAT(name,_rebind) : 
::boost::mpl::aux::rebind_base<BOOST_PP_CAT(name,_rebind)> \
 { \
  public: \
+    template <BOOST_MPL_PP_PARAMS(i,typename U)>                        \
+    
BOOST_PP_CAT(name,_rebind)(::boost::mpl::aux::type_wrapper<name<BOOST_MPL_PP_PARAMS(i,U)>
 >*); \
+                                                                        \
     template< BOOST_MPL_PP_PARAMS(i,typename U) > struct apply \
         : name< BOOST_MPL_PP_PARAMS(i,U) > \
     { \
-    }; \
+    };
 /**/
 #   else
 #   define BOOST_MPL_AUX_LAMBDA_SUPPORT(i, name, params) \

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to