updates for MPL renaming; restore some portability.

[SVN r1059]
This commit is contained in:
Dave Abrahams
2003-02-28 01:27:15 +00:00
parent 2d6d02dddf
commit 5f522787ca
6 changed files with 112 additions and 84 deletions

View File

@@ -13,8 +13,8 @@
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/bool_c.hpp> #include <boost/mpl/bool.hpp>
#include <boost/mpl/logical/or.hpp> #include <boost/mpl/or.hpp>
#include <iterator> #include <iterator>
#if BOOST_WORKAROUND(__MWERKS__, <=0x2407) #if BOOST_WORKAROUND(__MWERKS__, <=0x2407)
@@ -431,7 +431,7 @@ namespace boost {
template <class Base, class Derived> template <class Base, class Derived>
struct is_base_or_same : struct is_base_or_same :
mpl::logical_or< is_same< Base, Derived >, mpl::or_< is_same< Base, Derived >,
is_base_and_derived< Base, Derived > > is_base_and_derived< Base, Derived > >
{}; {};

View File

@@ -17,6 +17,7 @@
#ifdef BOOST_NO_MPL_AUX_HAS_XXX #ifdef BOOST_NO_MPL_AUX_HAS_XXX
# include <boost/shared_ptr.hpp> # include <boost/shared_ptr.hpp>
# include <boost/scoped_ptr.hpp> # include <boost/scoped_ptr.hpp>
# include <boost/mpl/bool.hpp>
# include <memory> # include <memory>
#endif #endif
@@ -43,12 +44,12 @@ namespace boost
template <class T> template <class T>
struct has_element_type struct has_element_type
: mpl::if_< {
typedef typename mpl::if_<
is_class<T> is_class<T>
, aux::has_element_type<T> , aux::has_element_type<T>
, mpl::false_c , mpl::false_
>::type >::type type;
{
}; };
# else # else
template <class T> template <class T>

View File

@@ -9,8 +9,8 @@
#ifndef BOOST_INTEROPERABLE_23022003THW_HPP #ifndef BOOST_INTEROPERABLE_23022003THW_HPP
#define BOOST_INTEROPERABLE_23022003THW_HPP #define BOOST_INTEROPERABLE_23022003THW_HPP
#include <boost/mpl/bool_c.hpp> #include <boost/mpl/bool.hpp>
#include <boost/mpl/logical/or.hpp> #include <boost/mpl/or.hpp>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
@@ -36,9 +36,9 @@ namespace boost
template <typename A, typename B> template <typename A, typename B>
struct is_interoperable struct is_interoperable
#if defined(BOOST_NO_IS_CONVERTIBLE) #if defined(BOOST_NO_IS_CONVERTIBLE)
: mpl::true_c : mpl::true_
#else #else
: mpl::logical_or< : mpl::or_<
is_convertible< A, B > is_convertible< A, B >
, is_convertible< B, A > > , is_convertible< B, A > >
#endif #endif

View File

@@ -16,8 +16,8 @@
#include <boost/iterator/iterator_facade.hpp> #include <boost/iterator/iterator_facade.hpp>
#include <boost/iterator/detail/enable_if.hpp> #include <boost/iterator/detail/enable_if.hpp>
#include <boost/mpl/logical/and.hpp> #include <boost/mpl/and.hpp>
#include <boost/mpl/logical/or.hpp> #include <boost/mpl/or.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_convertible.hpp>
@@ -31,16 +31,16 @@ namespace boost
{ {
template <class Traits, class Other> template <class Traits, class Other>
struct same_category_and_difference struct same_category_and_difference
: mpl::logical_and< : mpl::and_<
is_same< is_same<
typename Traits::iterator_category typename Traits::iterator_category
, typename Other::iterator_category , typename Other::iterator_category
> >
, is_same< , is_same<
typename Traits::iterator_category typename Traits::iterator_category
, typename Other::iterator_category , typename Other::iterator_category
> >
> >
{}; {};
@@ -106,7 +106,7 @@ namespace boost
# if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292) && BOOST_MSVC > 1300) # if BOOST_WORKAROUND(_MSC_FULL_VER, BOOST_TESTED_AT(13102292) && BOOST_MSVC > 1300)
// For some reason vc7.1 needs us to "cut off" instantiation // For some reason vc7.1 needs us to "cut off" instantiation
// of is_convertible in the case where From == To. // of is_convertible in the case where From == To.
mpl::logical_or<is_same<From,To>, is_convertible<From, To> > mpl::or_<is_same<From,To>, is_convertible<From, To> >
# else # else
::boost::is_convertible<From, To> ::boost::is_convertible<From, To>
# endif # endif

View File

@@ -18,11 +18,11 @@
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#include <boost/mpl/apply_if.hpp> #include <boost/mpl/apply_if.hpp>
#include <boost/mpl/if.hpp> #include <boost/mpl/if.hpp>
#include <boost/mpl/bool_c.hpp> #include <boost/mpl/bool.hpp>
#include <boost/mpl/aux_/has_xxx.hpp> #include <boost/mpl/aux_/has_xxx.hpp>
#include <boost/mpl/logical/not.hpp> #include <boost/mpl/not.hpp>
#include <boost/mpl/logical/or.hpp> #include <boost/mpl/or.hpp>
#include <boost/mpl/logical/and.hpp> #include <boost/mpl/and.hpp>
#include <iterator> #include <iterator>
#if BOOST_WORKAROUND(__MWERKS__, <=0x2407) #if BOOST_WORKAROUND(__MWERKS__, <=0x2407)
@@ -99,8 +99,8 @@ namespace boost {
// //
template <class Tag> template <class Tag>
struct is_new_iterator_tag : struct is_new_iterator_tag :
mpl::logical_and< mpl::logical_not< is_input_iterator<Tag> >, mpl::and_< mpl::not_< is_input_iterator<Tag> >,
mpl::logical_not< is_output_iterator<Tag> > > mpl::not_< is_output_iterator<Tag> > >
{}; {};
#elif BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \ #elif BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \
@@ -120,9 +120,10 @@ namespace boost {
struct is_new_iterator_tag struct is_new_iterator_tag
: //has_traversal<Tag> : //has_traversal<Tag>
mpl::if_< mpl::if_<
is_class<Tag> is_class<Tag>
, has_traversal<Tag> , has_traversal<Tag>
, mpl::bool_c<false> >::type , mpl::false_
>::type
{ {
}; };
@@ -202,7 +203,7 @@ namespace boost {
template <class RC, class TC> template <class RC, class TC>
struct cvt_iterator_category struct cvt_iterator_category
: mpl::if_< : mpl::if_<
mpl::logical_or< mpl::or_<
detail::is_mutable_lvalue_iterator<RC> detail::is_mutable_lvalue_iterator<RC>
, detail::is_constant_lvalue_iterator<RC> , detail::is_constant_lvalue_iterator<RC>
> >
@@ -221,13 +222,13 @@ namespace boost {
>::type >::type
, typename mpl::if_< , typename mpl::if_<
mpl::logical_and< mpl::and_<
detail::is_readable_iterator<RC> detail::is_readable_iterator<RC>
, detail::is_input_traversal_iterator<TC> , detail::is_input_traversal_iterator<TC>
> >
, std::input_iterator_tag , std::input_iterator_tag
, typename mpl::if_< , typename mpl::if_<
mpl::logical_and< mpl::and_<
detail::is_writable_iterator<RC> detail::is_writable_iterator<RC>
, detail::is_output_traversal_iterator<TC> , detail::is_output_traversal_iterator<TC>
> >
@@ -251,14 +252,14 @@ namespace boost {
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T> template <class T>
struct is_boost_iterator_tag struct is_boost_iterator_tag
: mpl::false_c {}; : mpl::false_ {};
template <class R, class T> template <class R, class T>
struct is_boost_iterator_tag<iterator_tag<R,T> > struct is_boost_iterator_tag<iterator_tag<R,T> >
: mpl::true_c {}; : mpl::true_ {};
# else # else
template <class T> template <class T>
struct is_boost_iterator_tag_impl struct is_boost_iterator_tag
{ {
typedef char (&yes)[1]; typedef char (&yes)[1];
typedef char (&no)[2]; typedef char (&no)[2];
@@ -269,12 +270,8 @@ namespace boost {
static T inst; static T inst;
BOOST_STATIC_CONSTANT(bool, value = sizeof(test(inst)) == sizeof(yes)); BOOST_STATIC_CONSTANT(bool, value = sizeof(test(inst)) == sizeof(yes));
typedef mpl::bool_<value> type;
}; };
template <class T>
struct is_boost_iterator_tag
: mpl::bool_c<is_boost_iterator_tag_impl<T>::value>
{};
# endif # endif
} }

View File

@@ -128,65 +128,95 @@ namespace boost
// (broken) implementations. // (broken) implementations.
// //
template < template <
class Derived class Derived
, class Traits , class Traits
> >
class iterator_facade class iterator_facade
: detail::std_iterator_from_traits<Traits> : public detail::std_iterator_from_traits<Traits>
{ {
typedef detail::std_iterator_from_traits<Traits> super_t; typedef detail::std_iterator_from_traits<Traits> super_t;
public: public:
// //
// CRT interface. There is no simple way to remove this // CRT interface. There is no simple way to remove this
// from the public interface without template friends // from the public interface without template friends
// //
typedef Derived derived_t; typedef Derived derived_t;
Derived& derived() Derived& derived()
{ {
return static_cast<Derived&>(*this); return static_cast<Derived&>(*this);
} }
Derived const& derived() const Derived const& derived() const
{ {
return static_cast<Derived const&>(*this); return static_cast<Derived const&>(*this);
} }
typedef typename super_t::reference reference; typedef typename super_t::reference reference;
typedef typename super_t::difference_type difference_type; typedef typename super_t::difference_type difference_type;
typedef typename super_t::pointer pointer; typedef typename super_t::pointer pointer;
reference operator*() const reference operator*() const
{ return iterator_core_access::dereference(this->derived()); } {
return iterator_core_access::dereference(this->derived());
}
// Needs eventual help for input iterators // Needs eventual help for input iterators
pointer operator->() const { return &iterator_core_access::dereference(this->derived()); } pointer operator->() const
{
return &iterator_core_access::dereference(this->derived());
}
reference operator[](difference_type n) const reference operator[](difference_type n) const
{ return *(*this + n); } {
return *(*this + n);
}
Derived& operator++() Derived& operator++()
{ iterator_core_access::increment(this->derived()); return this->derived(); } {
iterator_core_access::increment(this->derived());
return this->derived();
}
Derived operator++(int) Derived operator++(int)
{ Derived tmp(this->derived()); ++*this; return tmp; } {
Derived tmp(this->derived());
++*this;
return tmp;
}
Derived& operator--() Derived& operator--()
{ iterator_core_access::decrement(this->derived()); return this->derived(); } {
iterator_core_access::decrement(this->derived());
return this->derived();
}
Derived operator--(int) Derived operator--(int)
{ Derived tmp(this->derived()); --*this; return tmp; } {
Derived tmp(this->derived());
--*this;
return tmp;
}
Derived& operator+=(difference_type n) Derived& operator+=(difference_type n)
{ iterator_core_access::advance(this->derived(), n); return this->derived(); } {
iterator_core_access::advance(this->derived(), n);
return this->derived();
}
Derived& operator-=(difference_type n) Derived& operator-=(difference_type n)
{ iterator_core_access::advance(this->derived(), -n); return this->derived(); } {
iterator_core_access::advance(this->derived(), -n);
return this->derived();
}
Derived operator-(difference_type x) const Derived operator-(difference_type x) const
{ Derived result(this->derived()); return result -= x; } {
Derived result(this->derived());
return result -= x;
}
}; };
// //