diff --git a/include/boost/mpl/aux_/has_rebind.hpp b/include/boost/mpl/aux_/has_rebind.hpp index fe191be..de823ce 100644 --- a/include/boost/mpl/aux_/has_rebind.hpp +++ b/include/boost/mpl/aux_/has_rebind.hpp @@ -60,7 +60,7 @@ struct has_rebind #else // the rest template< typename T > struct has_rebind_tag {}; -yes_tag operator|(has_rebind_tag, void const volatile*); +no_tag operator|(has_rebind_tag, void const volatile*); # if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) template< typename T > @@ -68,7 +68,7 @@ struct has_rebind { static has_rebind_tag* get(); BOOST_STATIC_CONSTANT(bool, value = - sizeof(has_rebind_tag() | get()) == sizeof(char) + sizeof(has_rebind_tag() | get()) == sizeof(yes_tag) ); }; # else // __BORLANDC__ @@ -77,7 +77,7 @@ struct has_rebind_impl { static T* get(); BOOST_STATIC_CONSTANT(bool, value = - sizeof(has_rebind_tag() | get()) == sizeof(char) + sizeof(has_rebind_tag() | get()) == sizeof(yes_tag) ); }; diff --git a/include/boost/mpl/aux_/iterator_names.hpp b/include/boost/mpl/aux_/iterator_names.hpp deleted file mode 100644 index dcaa558..0000000 --- a/include/boost/mpl/aux_/iterator_names.hpp +++ /dev/null @@ -1,28 +0,0 @@ - -#ifndef BOOST_MPL_AUX_ITERATOR_NAMES_HPP_INCLUDED -#define BOOST_MPL_AUX_ITERATOR_NAMES_HPP_INCLUDED - -// Copyright Aleksey Gurtovoy 2002-2004 -// -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/mpl for documentation. - -// $Source$ -// $Date$ -// $Revision$ - -#include -#include - -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) -# define BOOST_MPL_AUX_ITERATOR_ADVANCE advance -# define BOOST_MPL_AUX_ITERATOR_DISTANCE distance_to -#else -# define BOOST_MPL_AUX_ITERATOR_ADVANCE advance_ -# define BOOST_MPL_AUX_ITERATOR_DISTANCE distance_to -#endif - -#endif // BOOST_MPL_AUX_ITERATOR_NAMES_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/lambda_support.hpp b/include/boost/mpl/aux_/lambda_support.hpp index 2c653cc..5d67d2a 100644 --- a/include/boost/mpl/aux_/lambda_support.hpp +++ b/include/boost/mpl/aux_/lambda_support.hpp @@ -24,9 +24,13 @@ #else # include +# include +# include # include +# include # include # include + # include # include # include @@ -109,15 +113,19 @@ template< typename T > struct has_rebind_tag; #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ template< BOOST_MPL_PP_PARAMS(i,typename T) > \ -char operator|( \ +::boost::mpl::aux::yes_tag operator|( \ ::boost::mpl::aux::has_rebind_tag \ , name* \ ); \ +::boost::mpl::aux::no_tag operator|( \ + ::boost::mpl::aux::has_rebind_tag \ + , name< BOOST_MPL_PP_ENUM(i,::boost::mpl::na) >* \ + ); \ /**/ #elif !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) # define BOOST_MPL_AUX_LAMBDA_SUPPORT_HAS_REBIND(i, name, params) \ template< BOOST_MPL_PP_PARAMS(i,typename T) > \ -char operator|( \ +::boost::mpl::aux::yes_tag operator|( \ ::boost::mpl::aux::has_rebind_tag \ , ::boost::mpl::aux::has_rebind_tag< name >* \ ); \ diff --git a/include/boost/mpl/aux_/msvc_eti_base.hpp b/include/boost/mpl/aux_/msvc_eti_base.hpp index 486772a..fa10296 100644 --- a/include/boost/mpl/aux_/msvc_eti_base.hpp +++ b/include/boost/mpl/aux_/msvc_eti_base.hpp @@ -40,6 +40,7 @@ template<> struct msvc_eti_base_impl typedef result_ first; typedef result_ second; typedef result_ tag; + enum { value = 0 }; }; }; @@ -68,6 +69,7 @@ template<> struct msvc_eti_base typedef msvc_eti_base first; typedef msvc_eti_base second; typedef msvc_eti_base tag; + enum { value = 0 }; }; }}} diff --git a/include/boost/mpl/aux_/na.hpp b/include/boost/mpl/aux_/na.hpp index 35096c2..416fe5d 100644 --- a/include/boost/mpl/aux_/na.hpp +++ b/include/boost/mpl/aux_/na.hpp @@ -15,22 +15,10 @@ // $Revision$ #include -#include +#include #include #include -BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN - -// n.a. == not available -struct na -{ - typedef na type; - enum { value = 0 }; -}; - -BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE -BOOST_MPL_AUX_ADL_BARRIER_DECL(na) - namespace boost { namespace mpl { template< typename T > diff --git a/include/boost/mpl/aux_/na_fwd.hpp b/include/boost/mpl/aux_/na_fwd.hpp new file mode 100644 index 0000000..7c330f8 --- /dev/null +++ b/include/boost/mpl/aux_/na_fwd.hpp @@ -0,0 +1,31 @@ + +#ifndef BOOST_MPL_AUX_NA_FWD_HPP_INCLUDED +#define BOOST_MPL_AUX_NA_FWD_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2001-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN + +// n.a. == not available +struct na +{ + typedef na type; + enum { value = 0 }; +}; + +BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE +BOOST_MPL_AUX_ADL_BARRIER_DECL(na) + +#endif // BOOST_MPL_AUX_NA_FWD_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/na_spec.hpp b/include/boost/mpl/aux_/na_spec.hpp index 1cae618..4e36124 100644 --- a/include/boost/mpl/aux_/na_spec.hpp +++ b/include/boost/mpl/aux_/na_spec.hpp @@ -104,6 +104,7 @@ struct lambda< \ > \ { \ typedef false_ is_le; \ + typedef name< BOOST_MPL_AUX_NA_PARAMS(i) > result_; \ typedef name< BOOST_MPL_AUX_NA_PARAMS(i) > type; \ }; \ /**/ diff --git a/include/boost/mpl/aux_/numeric_cast_utils.hpp b/include/boost/mpl/aux_/numeric_cast_utils.hpp new file mode 100644 index 0000000..4384b15 --- /dev/null +++ b/include/boost/mpl/aux_/numeric_cast_utils.hpp @@ -0,0 +1,77 @@ + +#ifndef BOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED +#define BOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2003-2004 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Source$ +// $Date$ +// $Revision$ + +#include +#include +#include + +namespace boost { namespace mpl { namespace aux { + +template< + typename F + , typename Tag1 + , typename Tag2 + > +struct cast1st_impl +{ + template< typename N1, typename N2 > struct apply +#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) + : apply_wrap2< + F + , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST,N1 >::type + , N2 + > + { +#else + { + typedef typename apply_wrap2< + F + , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST,N1 >::type + , N2 + >::type type; +#endif + }; +}; + +template< + typename F + , typename Tag1 + , typename Tag2 + > +struct cast2nd_impl +{ + template< typename N1, typename N2 > struct apply +#if !defined(BOOST_MPL_CFG_NO_NESTED_FORWARDING) + : apply_wrap2< + F + , N1 + , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST,N2 >::type + > + { +#else + { + typedef typename apply_wrap2< + F + , N1 + , typename apply_wrap1< BOOST_MPL_AUX_NUMERIC_CAST,N2 >::type + >::type type; +#endif + }; +}; + +}}} + +#endif // BOOST_MPL_AUX_NUMERIC_CAST_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/numeric_op.hpp b/include/boost/mpl/aux_/numeric_op.hpp index 9688398..6415aa0 100644 --- a/include/boost/mpl/aux_/numeric_op.hpp +++ b/include/boost/mpl/aux_/numeric_op.hpp @@ -22,6 +22,7 @@ # include # include # include +# include # include # include # include @@ -92,7 +93,7 @@ struct AUX778076_OP_IMPL_NAME #endif , aux::cast2nd_impl< AUX778076_OP_IMPL_NAME,Tag1,Tag2 > , aux::cast1st_impl< AUX778076_OP_IMPL_NAME,Tag1,Tag2 > - > + >::type { }; diff --git a/include/boost/mpl/aux_/range_c/iterator.hpp b/include/boost/mpl/aux_/range_c/iterator.hpp index 11f4b91..1c8b6f0 100644 --- a/include/boost/mpl/aux_/range_c/iterator.hpp +++ b/include/boost/mpl/aux_/range_c/iterator.hpp @@ -15,35 +15,85 @@ // $Revision$ #include +#include +#include #include +#include #include #include -#include +#include +#include namespace boost { namespace mpl { -template< typename N > -struct rc_iter +// theoretically will work on any discrete numeric type +template< typename N > struct r_iter { - typedef aux::rc_iter_tag tag; + typedef aux::r_iter_tag tag; typedef random_access_iterator_tag category; typedef N type; - typedef rc_iter::type> next; - typedef rc_iter::type> prior; +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + typedef r_iter< typename mpl::next::type > next; + typedef r_iter< typename mpl::prior::type > prior; +#endif +}; - template< typename D > - struct BOOST_MPL_AUX_ITERATOR_ADVANCE +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + +template< + typename N + > +struct next< r_iter > +{ + typedef r_iter< typename mpl::next::type > type; +}; + +template< + typename N + > +struct prior< r_iter > +{ + typedef r_iter< typename mpl::prior::type > type; +}; + +#endif + + +template<> struct advance_impl +{ + template< typename Iter, typename Dist > struct apply { - typedef rc_iter< - typename plus::type - > type; + typedef typename Iter::type n_; + typedef typename plus::type m_; + + // agurt, 10/nov/04: to be generic, the code have to do something along + // the lines below... + // + // typedef typename apply_wrap1< + // numeric_cast< typename m_::tag, typename n_::tag > + // , m_ + // >::type result_; + // + // ... meanwhile: + + typedef integral_c< + typename n_::value_type + , BOOST_MPL_AUX_VALUE_WKND(m_)::value + > result_; + + typedef r_iter type; }; +}; - template< typename U > - struct BOOST_MPL_AUX_ITERATOR_DISTANCE +template<> struct distance_impl +{ + template< typename Iter1, typename Iter2 > struct apply + : minus< + typename Iter2::type + , typename Iter1::type + > { - typedef typename minus::type type; }; }; diff --git a/include/boost/mpl/aux_/range_c/tag.hpp b/include/boost/mpl/aux_/range_c/tag.hpp index 121e680..13d48d6 100644 --- a/include/boost/mpl/aux_/range_c/tag.hpp +++ b/include/boost/mpl/aux_/range_c/tag.hpp @@ -17,7 +17,7 @@ namespace boost { namespace mpl { namespace aux { struct half_open_range_tag; -struct rc_iter_tag; +struct r_iter_tag; }}}