Split iterator_adaptors.hpp in multiple headers.

[SVN r1040]
This commit is contained in:
Thomas Witt committed 2003-02-23 21:12:51 +00:00
1 parent 78a01b30bc
commit 2d6d02dddf
19 files changed
+1315 -1109

No files matched your search

+69 -2
View File
@@ -9,9 +9,12 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/type_traits/conversion_traits.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/bool_c.hpp>
#include <boost/mpl/logical/or.hpp>
#include <iterator>
#if BOOST_WORKAROUND(__MWERKS__, <=0x2407)
@@ -207,7 +210,7 @@ namespace boost {
//
// The nested is_category template class are used for
// minimum category detection in iterator_adaptors.
// They are basically a pore mans is_derived replacement.
// They are basically a poore mans is_derived replacement.
//
// A implementation may look like this
//
@@ -392,6 +395,70 @@ namespace boost {
#endif
//
// I bet this is defined somewhere else. Let's wait and see.
//
struct error_type;
#ifdef BOOST_NO_IS_CONVERTIBLE
template <class Cat1, class Cat2>
struct minimum_return_category
: mpl::if_< is_return_category< Cat1 >::template is_category< Cat2 >,
Cat1,
mpl::if_< is_return_category<Cat2>::template is_category<Cat1>,
Cat2,
error_type
>
> {};
template <class Cat1, class Cat2>
struct minimum_traversal_category
: mpl::if_< is_traversal_category< Cat1 >::template is_category< Cat2 >,
Cat1,
mpl::if_< is_traversal_category<Cat2>::template is_category<Cat1>,
Cat2,
error_type
>
> {};
template <class T1, class T2>
struct minimum_category_select
: mpl::if_< is_same< typename T1::type, error_type >,
T2,
T1 >
{};
#endif
template <class Base, class Derived>
struct is_base_or_same :
mpl::logical_or< is_same< Base, Derived >,
is_base_and_derived< Base, Derived > >
{};
//
// Returns the minimum category type or error_type
// if T1 and T2 are unrelated.
//
// For compilers not supporting is_convertible this only
// works with the new boost return and traversal category
// types. The exect boost _types_ are required. No derived types
// will work.
//
//
template <class T1, class T2>
struct minimum_category :
#ifndef BOOST_NO_IS_CONVERTIBLE
mpl::if_< is_base_or_same< T1, T2 >,
T1,
mpl::if_< is_base_or_same< T2, T1 >,
T2,
error_type > >
#else
minimum_category_select< minimum_return_category<T1, T2>,
minimum_traversal_category<T1, T2> >
#endif
{};
} // namespace detail
} // namespace boost
@@ -0,0 +1,43 @@
// (C) Copyright David Abrahams 2002.
// (C) Copyright Jeremy Siek 2002.
// (C) Copyright Thomas Witt 2002.
// Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// no include guard multiple inclusion intended
//
// This is a temporary workaround until the bulk of this is
// available in boost config.
// 23/02/03 thw
//
#include <boost/config.hpp> // for prior
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| BOOST_WORKAROUND(__GNUC__, <= 2 && __GNUC_MINOR__ <= 95) \
|| BOOST_WORKAROUND(__MWERKS__, <= 0x3000)
# define BOOST_NO_SFINAE // "Substitution Failure Is Not An Error not implemented"
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, <=1200)
# define BOOST_ARG_DEP_TYPENAME
#else
# define BOOST_ARG_DEP_TYPENAME typename
#endif
#if BOOST_WORKAROUND(__MWERKS__, <=0x2407)
# define BOOST_NO_IS_CONVERTIBLE // "is_convertible doesn't always work"
#endif
#if BOOST_WORKAROUND(__GNUC__, == 2 && __GNUC_MINOR__ == 95) \
|| BOOST_WORKAROUND(__MWERKS__, <= 0x2407) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551))
# define BOOST_NO_MPL_AUX_HAS_XXX // "MPL's has_xxx facility doesn't work"
#endif
// no include guard multiple inclusion intended
@@ -0,0 +1,20 @@
// (C) Copyright Thomas Witt 2002.
// Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
// no include guard multiple inclusion intended
//
// This is a temporary workaround until the bulk of this is
// available in boost config.
// 23/02/03 thw
//
# undef BOOST_NO_SFINAE
# undef BOOST_ARG_DEP_TYPENAME
# undef BOOST_NO_IS_CONVERTIBLE
# undef BOOST_NO_MPL_AUX_HAS_XXX
@@ -0,0 +1,88 @@
// (C) Copyright David Abrahams 2002.
// (C) Copyright Jeremy Siek 2002.
// (C) Copyright Thomas Witt 2002.
// Permission to copy, use, modify,
// sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided
// "as is" without express or implied warranty, and with no claim as
// to its suitability for any purpose.
#ifndef BOOST_ENABLE_IF_23022003THW_HPP
#define BOOST_ENABLE_IF_23022003THW_HPP
#include <boost/detail/workaround.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/iterator/detail/config_def.hpp>
//
// Boost iterators uses its own enable_if cause we need
// special semantics for deficient compilers.
// 23/02/03 thw
//
namespace boost
{
namespace detail
{
//
// Base machinery for all kinds of enable if
//
template<bool>
struct enabled
{
template<typename T>
struct base
{
typedef T type;
};
};
//
// For compilers that don't support "Substitution Failure Is Not An Error"
// enable_if falls back to always enabled. See comments
// on operator implementation for consequences.
//
template<>
struct enabled<false>
{
template<typename T>
struct base
{
#ifdef BOOST_NO_SFINAE
typedef T type;
// This way to do it would give a nice error message containing
// invalid overload, but has the big disadvantage that
// there is no reference to user code in the error message.
//
// struct invalid_overload;
// typedef invalid_overload type;
//
#endif
};
};
template <class Cond,
class Return>
struct enable_if
# if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_IS_CONVERTIBLE)
: enabled<Cond::value>::template base<Return>
# else
: mpl::identity<Return>
# endif
{
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
typedef Return type;
# endif
};
} // namespace detail
} // namespace boost
#include <boost/iterator/detail/config_undef.hpp>
#endif // BOOST_ENABLE_IF_23022003THW_HPP