Added boost header

This commit is contained in:
Christophe Riccio
2012-01-08 01:26:07 +00:00
parent 9c3faaca40
commit c7d752cdf8
8946 changed files with 1732316 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
#ifndef BOOST_PHOENIX_ALGORITHM_DETAIL_BEGIN_HPP
#define BOOST_PHOENIX_ALGORITHM_DETAIL_BEGIN_HPP
#include <boost/range/result_iterator.hpp>
#include <boost/range/begin.hpp>
namespace boost { namespace phoenix {
namespace detail
{
template<class R>
typename range_result_iterator<R>::type
begin_(R& r)
{
return boost::begin(r);
}
}
}}
#endif

View File

@@ -0,0 +1,36 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
#ifndef BOOST_PHOENIX_ALGORITHM_DETAIL_DECAY_ARRAY_HPP
#define BOOST_PHOENIX_ALGORITHM_DETAIL_DECAY_ARRAY_HPP
namespace boost { namespace phoenix {
namespace detail
{
template<typename T>
struct decay_array
{
typedef T type;
};
template<typename T, int N>
struct decay_array<T[N]>
{
typedef T* type;
};
template<typename T, int N>
struct decay_array<T (&)[N]>
{
typedef T* type;
};
}
}}
#endif

View File

@@ -0,0 +1,28 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
#ifndef BOOST_PHOENIX_ALGORITHM_DETAIL_END_HPP
#define BOOST_PHOENIX_ALGORITHM_DETAIL_END_HPP
#include <boost/range/result_iterator.hpp>
#include <boost/range/end.hpp>
namespace boost { namespace phoenix {
namespace detail
{
template<class R>
typename range_result_iterator<R>::type
end_(R& r)
{
return boost::end(r);
}
}
}}
#endif

View File

@@ -0,0 +1,51 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_equal_range.hpp
//
/////////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) && _MSC_VER >= 1000
#pragma once
#endif
#ifndef BOOST_PHOENIX_HAS_EQUAL_RANGE_EN_14_12_2004
#define BOOST_PHOENIX_HAS_EQUAL_RANGE_EN_14_12_2004
#include <boost/mpl/or.hpp>
#include "./is_std_map.hpp"
#include "./is_std_set.hpp"
#include "./is_std_hash_map.hpp"
#include "./is_std_hash_set.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_equal_range
: boost::mpl::or_<
boost::mpl::or_<
is_std_map<T>
, is_std_multimap<T>
, is_std_set<T>
, is_std_multiset<T>
>
, boost::mpl::or_<
is_std_hash_map<T>
, is_std_hash_multimap<T>
, is_std_hash_set<T>
, is_std_hash_multiset<T>
>
>
{
};
}
#endif

View File

@@ -0,0 +1,47 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_find.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_HAS_FIND_EN_14_12_2004
#define BOOST_PHOENIX_HAS_FIND_EN_14_12_2004
#include <boost/mpl/or.hpp>
#include "./is_std_map.hpp"
#include "./is_std_set.hpp"
#include "./is_std_hash_map.hpp"
#include "./is_std_hash_set.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_find
: boost::mpl::or_<
boost::mpl::or_<
is_std_map<T>
, is_std_multimap<T>
, is_std_set<T>
, is_std_multiset<T>
>
, boost::mpl::or_<
is_std_hash_map<T>
, is_std_hash_multimap<T>
, is_std_hash_set<T>
, is_std_hash_multiset<T>
>
>
{
};
}
#endif

View File

@@ -0,0 +1,51 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_lower_bound.hpp
//
/////////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) && _MSC_VER >= 1000
#pragma once
#endif
#ifndef BOOST_PHOENIX_HAS_LOWER_BOUND_EN_14_12_2004
#define BOOST_PHOENIX_HAS_LOWER_BOUND_EN_14_12_2004
#include <boost/mpl/or.hpp>
#include "./is_std_map.hpp"
#include "./is_std_set.hpp"
#include "./is_std_hash_map.hpp"
#include "./is_std_hash_set.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_lower_bound
: boost::mpl::or_<
boost::mpl::or_<
is_std_map<T>
, is_std_multimap<T>
, is_std_set<T>
, is_std_multiset<T>
>
, boost::mpl::or_<
is_std_hash_map<T>
, is_std_hash_multimap<T>
, is_std_hash_set<T>
, is_std_hash_multiset<T>
>
>
{
};
}
#endif

View File

@@ -0,0 +1,30 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_remove.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_HAS_REMOVE_EN_14_12_2004
#define BOOST_PHOENIX_HAS_REMOVE_EN_14_12_2004
#include "./is_std_list.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_remove
: is_std_list<T>
{
};
}
#endif

View File

@@ -0,0 +1,34 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_remove_if.hpp
//
/////////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) && _MSC_VER >= 1000
#pragma once
#endif
#ifndef BOOST_PHOENIX_HAS_REMOVE_IF_EN_14_12_2004
#define BOOST_PHOENIX_HAS_REMOVE_IF_EN_14_12_2004
#include "./is_std_list.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_remove_if
: is_std_list<T>
{
};
}
#endif

View File

@@ -0,0 +1,34 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_reverse.hpp
//
/////////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) && _MSC_VER >= 1000
#pragma once
#endif
#ifndef BOOST_PHOENIX_HAS_REVERSE_EN_14_12_2004
#define BOOST_PHOENIX_HAS_REVERSE_EN_14_12_2004
#include "./is_std_list.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_reverse
: is_std_list<T>
{
};
}
#endif

View File

@@ -0,0 +1,30 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_sort.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_HAS_SORT_EN_14_12_2004
#define BOOST_PHOENIX_HAS_SORT_EN_14_12_2004
#include "./is_std_list.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_sort
: is_std_list<T>
{
};
}
#endif

View File

@@ -0,0 +1,34 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_unique.hpp
//
/////////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) && _MSC_VER >= 1000
#pragma once
#endif
#ifndef BOOST_PHOENIX_HAS_UNIQUE_EN_14_12_2004
#define BOOST_PHOENIX_HAS_UNIQUE_EN_14_12_2004
#include "./is_std_list.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_unique
: is_std_list<T>
{
};
}
#endif

View File

@@ -0,0 +1,47 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// has_upper_bound.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_HAS_UPPER_BOUND_EN_14_12_2004
#define BOOST_PHOENIX_HAS_UPPER_BOUND_EN_14_12_2004
#include <boost/mpl/or.hpp>
#include "./is_std_map.hpp"
#include "./is_std_set.hpp"
#include "./is_std_hash_map.hpp"
#include "./is_std_hash_set.hpp"
namespace boost
{
// Specialize this for user-defined types
template<typename T>
struct has_upper_bound
: boost::mpl::or_<
boost::mpl::or_<
is_std_map<T>
, is_std_multimap<T>
, is_std_set<T>
, is_std_multiset<T>
>
, boost::mpl::or_<
is_std_hash_map<T>
, is_std_hash_multimap<T>
, is_std_hash_set<T>
, is_std_hash_multiset<T>
>
>
{
};
}
#endif

View File

@@ -0,0 +1,83 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// is_std_hash_map.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_IS_STD_HASH_MAP_EN_16_12_2004
#define BOOST_PHOENIX_IS_STD_HASH_MAP_EN_16_12_2004
#include <boost/mpl/bool.hpp>
#include "./std_hash_map_fwd.hpp"
namespace boost
{
template<class T>
struct is_std_hash_map
: boost::mpl::false_
{};
template<class T>
struct is_std_hash_multimap
: boost::mpl::false_
{};
#ifdef BOOST_HAS_HASH
template<
class Kty
, class Ty
, class Hash
, class Cmp
, class Alloc
>
struct is_std_hash_map< ::BOOST_STD_EXTENSION_NAMESPACE::hash_map<Kty,Ty,Hash,Cmp,Alloc> >
: boost::mpl::true_
{};
template<
class Kty
, class Ty
, class Hash
, class Cmp
, class Alloc
>
struct is_std_hash_multimap< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<Kty,Ty,Hash,Cmp,Alloc> >
: boost::mpl::true_
{};
#elif defined(BOOST_DINKUMWARE_STDLIB)
template<
class Kty
, class Ty
, class Tr
, class Alloc
>
struct is_std_hash_map< ::BOOST_STD_EXTENSION_NAMESPACE::hash_map<Kty,Ty,Tr,Alloc> >
: boost::mpl::true_
{};
template<
class Kty
, class Ty
, class Tr
, class Alloc
>
struct is_std_hash_multimap< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multimap<Kty,Ty,Tr,Alloc> >
: boost::mpl::true_
{};
#endif
}
#endif

View File

@@ -0,0 +1,79 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// is_std_hash_set.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_IS_STD_HASH_SET_EN_16_12_2004
#define BOOST_PHOENIX_IS_STD_HASH_SET_EN_16_12_2004
#include <boost/mpl/bool.hpp>
#include "./std_hash_set_fwd.hpp"
namespace boost
{
template<class T>
struct is_std_hash_set
: boost::mpl::false_
{};
template<class T>
struct is_std_hash_multiset
: boost::mpl::false_
{};
#if defined(BOOST_HAS_HASH)
template<
class Kty
, class Hash
, class Cmp
, class Alloc
>
struct is_std_hash_set< ::BOOST_STD_EXTENSION_NAMESPACE::hash_set<Kty,Hash,Cmp,Alloc> >
: boost::mpl::true_
{};
template<
class Kty
, class Hash
, class Cmp
, class Alloc
>
struct is_std_hash_multiset< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Kty,Hash,Cmp,Alloc> >
: boost::mpl::true_
{};
#elif defined(BOOST_DINKUMWARE_STDLIB)
template<
class Kty
, class Tr
, class Alloc
>
struct is_std_hash_set< ::BOOST_STD_EXTENSION_NAMESPACE::hash_set<Kty,Tr,Alloc> >
: boost::mpl::true_
{};
template<
class Kty
, class Tr
, class Alloc
>
struct is_std_hash_multiset< ::BOOST_STD_EXTENSION_NAMESPACE::hash_multiset<Kty,Tr,Alloc> >
: boost::mpl::true_
{};
#endif
}
#endif

View File

@@ -0,0 +1,37 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// is_std_list.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_IS_STD_LIST_EN_16_12_2004
#define BOOST_PHOENIX_IS_STD_LIST_EN_16_12_2004
#include <boost/mpl/bool.hpp>
#include <boost/detail/container_fwd.hpp>
namespace boost
{
template<class T>
struct is_std_list
: boost::mpl::false_
{};
template<
class Ty
, class Alloc
>
struct is_std_list< ::std::list<Ty,Alloc> >
: boost::mpl::true_
{};
}
#endif

View File

@@ -0,0 +1,54 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// is_std_map.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_IS_STD_MAP_EN_16_12_2004
#define BOOST_PHOENIX_IS_STD_MAP_EN_16_12_2004
#include <boost/mpl/bool.hpp>
#include <boost/detail/container_fwd.hpp>
namespace boost
{
template<class T>
struct is_std_map
: boost::mpl::false_
{};
template<
class Kty
, class Ty
, class Pr
, class Alloc
>
struct is_std_map< ::std::map<Kty,Ty,Pr,Alloc> >
: boost::mpl::true_
{};
template<class T>
struct is_std_multimap
: boost::mpl::false_
{};
template<
class Kty
, class Ty
, class Pr
, class Alloc
>
struct is_std_multimap< ::std::multimap<Kty,Ty,Pr,Alloc> >
: boost::mpl::true_
{};
}
#endif

View File

@@ -0,0 +1,56 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// is_std_set.hpp
//
/////////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) && _MSC_VER >= 1000
# pragma once
#endif
#ifndef BOOST_PHOENIX_IS_STD_SET_EN_16_12_2004
#define BOOST_PHOENIX_IS_STD_SET_EN_16_12_2004
#include <boost/mpl/bool.hpp>
#include <boost/detail/container_fwd.hpp>
namespace boost
{
template<class T>
struct is_std_set
: boost::mpl::false_
{};
template<
class Kty
, class Pr
, class Alloc
>
struct is_std_set< ::std::set<Kty,Pr,Alloc> >
: boost::mpl::true_
{};
template<class T>
struct is_std_multiset
: boost::mpl::false_
{};
template<
class Kty
, class Pr
, class Alloc
>
struct is_std_multiset< ::std::multiset<Kty,Pr,Alloc> >
: boost::mpl::true_
{};
}
#endif

View File

@@ -0,0 +1,70 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// std_hash_map_fwd.hpp
//
/////////////////////////////////////////////////////////////////////////////
#if defined(_MSC_VER) && _MSC_VER >= 1000
# pragma once
#endif
#ifndef BOOST_PHOENIX_STD_HASH_MAP_FWD_EN_16_12_2004
#define BOOST_PHOENIX_STD_HASH_MAP_FWD_EN_16_12_2004
#include <boost/config.hpp>
#if defined(BOOST_HAS_HASH)
namespace BOOST_STD_EXTENSION_NAMESPACE
{
template<
class Kty
, class Ty
, class Hash
, class Cmp
, class Alloc
>
class hash_map;
template<
class Kty
, class Ty
, class Hash
, class Cmp
, class Alloc
>
class hash_multimap;
}
#elif defined(BOOST_DINKUMWARE_STDLIB)
namespace BOOST_STD_EXTENSION_NAMESPACE
{
template<
class Kty
, class Ty
, class Tr
, class Alloc
>
class hash_map;
template<
class Kty
, class Ty
, class Tr
, class Alloc
>
class hash_multimap;
}
#endif
#endif

View File

@@ -0,0 +1,62 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// std_hash_set_fwd.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_STD_HASH_SET_FWD_EN_16_12_2004
#define BOOST_PHOENIX_STD_HASH_SET_FWD_EN_16_12_2004
#include <boost/config.hpp>
#if defined(BOOST_HAS_HASH)
namespace BOOST_STD_EXTENSION_NAMESPACE
{
template<
class Kty
, class Hash
, class Cmp
, class Alloc
>
class hash_set;
template<
class Kty
, class Hash
, class Cmp
, class Alloc
>
class hash_multiset;
}
#elif defined(BOOST_DINKUMWARE_STDLIB)
namespace BOOST_STD_EXTENSION_NAMESPACE
{
template<
class Kty
, class Tr
, class Alloc
>
class hash_set;
template<
class Kty
, class Tr
, class Alloc
>
class hash_multiset;
}
#endif
#endif

View File

@@ -0,0 +1,97 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2005 Dan Marsden.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
#ifndef BOOST_PHOENIX_ALGORITHM_ITERATION_HPP
#define BOOST_PHOENIX_ALGORITHM_ITERATION_HPP
#include <algorithm>
#include <numeric>
#include <boost/phoenix/stl/algorithm/detail/begin.hpp>
#include <boost/phoenix/stl/algorithm/detail/end.hpp>
#include <boost/phoenix/function/adapt_callable.hpp>
namespace boost { namespace phoenix {
namespace impl
{
struct for_each
{
template <typename Sig>
struct result;
template<typename This, class R, class F>
struct result<This(R&, F)>
: result<This(R&, F const &)>
{};
template<typename This, class R, class F>
struct result<This(R&, F &)>
{
typedef F type;
};
template<class R, class F>
F const operator()(R& r, F const& fn) const
{
return std::for_each(detail::begin_(r), detail::end_(r), fn);
}
};
struct accumulate
{
template <typename Sig>
struct result;
template<typename This, class R, class I>
struct result<This(R&, I)>
: result<This(R&, I const &)>
{};
template<typename This, class R, class I>
struct result<This(R&, I &)>
{
typedef I type;
};
template<typename This, class R, class I, class C>
struct result<This(R&, I, C)>
: result<This(R&, I const &, C)>
{};
template<typename This, class R, class I, class C>
struct result<This(R&, I &, C)>
{
typedef I type;
};
template<class R, class I>
I
operator()(R& r, I i) const
{
return std::accumulate(detail::begin_(r), detail::end_(r), i);
}
template<class R, class I, class C>
I
operator()(R& r, I i, C c) const
{
return std::accumulate(detail::begin_(r), detail::end_(r), i, c);
}
};
}
BOOST_PHOENIX_ADAPT_CALLABLE(for_each, impl::for_each, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(accumulate, impl::accumulate, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(accumulate, impl::accumulate, 3)
}}
#endif

View File

@@ -0,0 +1,658 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2005 Dan Marsden.
// Copyright 2008 Hartmut Kaiser.
//
// Use, modification and distribution is subject to 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)
//
// Modeled after range_ex, Copyright 2004 Eric Niebler
#ifndef BOOST_PHOENIX_ALGORITHM_QUERYING_HPP
#define BOOST_PHOENIX_ALGORITHM_QUERYING_HPP
#include <algorithm>
#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/stl/algorithm/detail/has_find.hpp>
#include <boost/phoenix/stl/algorithm/detail/has_lower_bound.hpp>
#include <boost/phoenix/stl/algorithm/detail/has_upper_bound.hpp>
#include <boost/phoenix/stl/algorithm/detail/has_equal_range.hpp>
#include <boost/phoenix/stl/algorithm/detail/begin.hpp>
#include <boost/phoenix/stl/algorithm/detail/end.hpp>
#include <boost/phoenix/stl/algorithm/detail/decay_array.hpp>
#include <boost/phoenix/function/adapt_callable.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/difference_type.hpp>
namespace boost { namespace phoenix {
namespace impl
{
struct find
{
template <typename Sig>
struct result;
template <typename This, class R, class T>
struct result<This(R&, T const&)>
: range_result_iterator<R>
{};
template<class R, class T>
typename range_result_iterator<R>::type
execute(R& r, T const& x, mpl::true_) const
{
return r.find(x);
}
template<class R, class T>
typename range_result_iterator<R>::type
execute(R& r, T const& x, mpl::false_) const
{
return std::find(detail::begin_(r), detail::end_(r), x);
}
template<class R, class T>
typename range_result_iterator<R>::type
operator()(R& r, T const& x) const
{
return execute(r, x, has_find<R>());
}
};
struct find_if
{
template <typename Sig>
struct result;
template <typename This, class R, class P>
struct result<This(R&, P)>
: range_result_iterator<R>
{};
template<class R, class P>
typename range_result_iterator<R>::type
operator()(R& r, P p) const
{
return std::find_if(detail::begin_(r), detail::end_(r), p);
}
};
struct find_end
{
template <typename Sig>
struct result;
template<typename This, class R, class R2>
struct result<This(R&, R2&)>
: range_result_iterator<R>
{};
template<typename This, class R, class R2, class P>
struct result<This(R&, R2&, P)>
: range_result_iterator<R>
{};
template<class R, class R2>
typename range_result_iterator<R>::type
operator()(R& r, R2& r2) const
{
return std::find_end(
detail::begin_(r)
, detail::end_(r)
, detail::begin_(r2)
, detail::end_(r2)
);
}
template<class R, class R2, class P>
typename range_result_iterator<R>::type
operator()(R& r, R2& r2, P p) const
{
return std::find_end(
detail::begin_(r)
, detail::end_(r)
, detail::begin_(r2)
, detail::end_(r2)
, p
);
}
};
struct find_first_of
{
template <typename Sig>
struct result;
template<typename This, class R, class R2>
struct result<This(R&, R2&)>
: range_result_iterator<R>
{};
template<typename This, class R, class R2, class P>
struct result<This(R&, R2&, P)>
: range_result_iterator<R>
{};
template<class R, class R2>
typename range_result_iterator<R>::type
operator()(R& r, R2& r2) const
{
return std::find_first_of(
detail::begin_(r)
, detail::end_(r)
, detail::begin_(r2)
, detail::end_(r2)
);
}
template<class R, class R2, class P>
typename range_result_iterator<R>::type
operator()(R& r, R2& r2, P p) const
{
return std::find_first_of(
detail::begin_(r)
, detail::end_(r)
, detail::begin_(r2)
, detail::end_(r2)
, p
);
}
};
struct adjacent_find
{
template <typename Sig>
struct result;
template <typename This, class R>
struct result<This(R&)>
: range_result_iterator<R>
{};
template <typename This, class R, class P>
struct result<This(R&, P)>
: range_result_iterator<R>
{};
template<class R>
typename range_result_iterator<R>::type
operator()(R& r) const
{
return std::adjacent_find(detail::begin_(r), detail::end_(r));
}
template<class R, class P>
typename range_result_iterator<R>::type
operator()(R& r, P p) const
{
return std::adjacent_find(detail::begin_(r), detail::end_(r), p);
}
};
struct count
{
template <typename Sig>
struct result;
template <typename This, class R, class T>
struct result<This(R&, T const&)>
: range_difference<R>
{};
template<class R, class T>
typename range_difference<R>::type
operator()(R& r, T const& x) const
{
return std::count(detail::begin_(r), detail::end_(r), x);
}
};
struct count_if
{
template <typename Sig>
struct result;
template <typename This, class R, class P>
struct result<This(R&, P)>
: range_difference<R>
{};
template<class R, class P>
typename range_difference<R>::type
operator()(R& r, P p) const
{
return std::count_if(detail::begin_(r), detail::end_(r), p);
}
};
struct distance
{
template <typename Sig>
struct result;
template <typename This, class R>
struct result<This(R&)>
: range_difference<R>
{};
template<class R>
typename range_difference<R>::type
operator()(R& r) const
{
return std::distance(detail::begin_(r), detail::end_(r));
}
};
struct equal
{
typedef bool result_type;
template<class R, class I>
bool operator()(R& r, I i) const
{
return std::equal(detail::begin_(r), detail::end_(r), i);
}
template<class R, class I, class P>
bool operator()(R& r, I i, P p) const
{
return std::equal(detail::begin_(r), detail::end_(r), i, p);
}
};
struct search
{
template <typename Sig>
struct result;
template <typename This, class R, typename R2>
struct result<This(R&, R2&)>
: range_result_iterator<R>
{};
template <typename This, class R, typename R2, class P>
struct result<This(R&, R2&, P)>
: range_result_iterator<R>
{};
template<class R, class R2>
typename range_result_iterator<R>::type
operator()(R& r, R2& r2) const
{
return std::search(
detail::begin_(r)
, detail::end_(r)
, detail::begin_(r2)
, detail::end_(r2)
);
}
template<class R, class R2, class P>
typename range_result_iterator<R>::type
operator()(R& r, R2& r2, P p) const
{
return std::search(
detail::begin_(r)
, detail::end_(r)
, detail::begin_(r2)
, detail::end_(r2)
, p
);
}
};
struct lower_bound
{
template <typename Sig>
struct result;
template <typename This, class R, class T>
struct result<This(R&, T const&)>
: range_result_iterator<R>
{};
template <typename This, class R, class T, class C>
struct result<This(R&, T const&, C)>
: range_result_iterator<R>
{};
template<class R, class T>
typename range_result_iterator<R>::type
execute(R& r, T const& val, mpl::true_) const
{
return r.lower_bound(val);
}
template<class R, class T>
typename range_result_iterator<R>::type
execute(R& r, T const& val, mpl::false_) const
{
return std::lower_bound(detail::begin_(r), detail::end_(r), val);
}
template<class R, class T>
typename range_result_iterator<R>::type
operator()(R& r, T const& val) const
{
return execute(r, val, has_lower_bound<R>());
}
template<class R, class T, class C>
typename range_result_iterator<R>::type
operator()(R& r, T const& val, C c) const
{
return std::lower_bound(detail::begin_(r), detail::end_(r), val, c);
}
};
struct upper_bound
{
template <typename Sig>
struct result;
template <typename This, class R, class T>
struct result<This(R&, T const&)>
: range_result_iterator<R>
{};
template <typename This, class R, class T, class C>
struct result<This(R&, T const&, C)>
: range_result_iterator<R>
{};
template<class R, class T>
typename range_result_iterator<R>::type
execute(R& r, T const& val, mpl::true_) const
{
return r.upper_bound(val);
}
template<class R, class T>
typename range_result_iterator<R>::type
execute(R& r, T const& val, mpl::false_) const
{
return std::upper_bound(detail::begin_(r), detail::end_(r), val);
}
template<class R, class T>
typename range_result_iterator<R>::type
operator()(R& r, T const& val) const
{
return execute(r, val, has_upper_bound<R>());
}
template<class R, class T, class C>
typename range_result_iterator<R>::type
operator()(R& r, T const& val, C c) const
{
return std::upper_bound(detail::begin_(r), detail::end_(r), val, c);
}
};
namespace result_of
{
template <typename R, typename T, typename C = void>
struct equal_range
{
typedef std::pair<
typename range_result_iterator<R>::type
, typename range_result_iterator<R>::type
> type;
};
}
struct equal_range
{
template <typename Sig>
struct result;
template <typename This, class R, class T>
struct result<This(R&, T const&)>
: result_of::equal_range<R,T>
{};
template <typename This, class R, class T, class C>
struct result<This(R&, T const&, C)>
: result_of::equal_range<R,T, C>
{};
template<class R, class T>
typename result_of::equal_range<R, T>::type
execute(R& r, T const& val, mpl::true_) const
{
return r.equal_range(val);
}
template<class R, class T>
typename result_of::equal_range<R, T>::type
execute(R& r, T const& val, mpl::false_) const
{
return std::equal_range(detail::begin_(r), detail::end_(r), val);
}
template<class R, class T>
typename result_of::equal_range<R, T>::type
operator()(R& r, T const& val) const
{
return execute(r, val, has_equal_range<R>());
}
template<class R, class T, class C>
typename result_of::equal_range<R, T, C>::type
operator()(R& r, T const& val, C c) const
{
return std::equal_range(detail::begin_(r), detail::end_(r), val, c);
}
};
namespace result_of
{
template <typename R, typename I, typename P = void>
struct mismatch
{
typedef std::pair<
typename range_result_iterator<R>::type
, typename detail::decay_array<I>::type
> type;
};
}
struct mismatch
{
template <typename Sig>
struct result;
template<typename This, class R, class I>
struct result<This(R&, I)>
: result_of::mismatch<R, I>
{};
template<typename This, class R, class I, class P>
struct result<This(R&, I, P)>
: result_of::mismatch<R, I, P>
{};
template<class R, class I>
typename result_of::mismatch<R, I>::type
operator()(R& r, I i) const
{
return std::mismatch(detail::begin_(r), detail::end_(r), i);
}
template<class R, class I, class P>
typename result_of::mismatch<R, I, P>::type
operator()(R& r, I i, P p) const
{
return std::mismatch(detail::begin_(r), detail::end_(r), i, p);
}
};
struct binary_search
{
typedef bool result_type;
template<class R, class T>
bool operator()(R& r, T const& val) const
{
return std::binary_search(detail::begin_(r), detail::end_(r), val);
}
template<class R, class T, class C>
bool operator()(R& r, T const& val, C c) const
{
return std::binary_search(detail::begin_(r), detail::end_(r), val, c);
}
};
struct includes
{
typedef bool result_type;
template<class R1, class R2>
bool operator()(R1& r1, R2& r2) const
{
return std::includes(
detail::begin_(r1), detail::end_(r1)
, detail::begin_(r2), detail::end_(r2)
);
}
template<class R1, class R2, class C>
bool operator()(R1& r1, R2& r2, C c) const
{
return std::includes(
detail::begin_(r1), detail::end_(r1)
, detail::begin_(r2), detail::end_(r2)
, c
);
}
};
struct min_element
{
template <typename Sig>
struct result;
template <typename This, class R>
struct result<This(R&)>
: range_result_iterator<R>
{};
template <typename This, class R, class P>
struct result<This(R&, P)>
: range_result_iterator<R>
{};
template<class R>
typename range_result_iterator<R>::type
operator()(R& r) const
{
return std::min_element(detail::begin_(r), detail::end_(r));
}
template<class R, class P>
typename range_result_iterator<R>::type
operator()(R& r, P p) const
{
return std::min_element(detail::begin_(r), detail::end_(r), p);
}
};
struct max_element
{
template <typename Sig>
struct result;
template <typename This, class R>
struct result<This(R&)>
: range_result_iterator<R>
{};
template <typename This, class R, class P>
struct result<This(R&, P)>
: range_result_iterator<R>
{};
template<class R>
typename range_result_iterator<R>::type
operator()(R& r) const
{
return std::max_element(detail::begin_(r), detail::end_(r));
}
template<class R, class P>
typename range_result_iterator<R>::type
operator()(R& r, P p) const
{
return std::max_element(detail::begin_(r), detail::end_(r), p);
}
};
struct lexicographical_compare
{
typedef bool result_type;
template<class R1, class R2>
bool operator()(R1& r1, R2& r2) const
{
return std::lexicographical_compare(
detail::begin_(r1), detail::end_(r1)
, detail::begin_(r2), detail::end_(r2)
);
}
template<class R1, class R2, class P>
bool operator()(R1& r1, R2& r2, P p) const
{
return std::lexicographical_compare(
detail::begin_(r1), detail::end_(r1)
, detail::begin_(r2), detail::end_(r2)
, p
);
}
};
}
BOOST_PHOENIX_ADAPT_CALLABLE(find, impl::find, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(find_if, impl::find_if, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(find_end, impl::find_end, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(find_end, impl::find_end, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(find_first_of, impl::find_first_of, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(find_first_of, impl::find_first_of, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(adjacent_find, impl::adjacent_find, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(adjacent_find, impl::adjacent_find, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(count, impl::count, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(count_if, impl::count_if, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(distance, impl::distance, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(equal, impl::equal, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(equal, impl::equal, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(search, impl::search, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(search, impl::search, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(lower_bound, impl::lower_bound, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(lower_bound, impl::lower_bound, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(upper_bound, impl::upper_bound, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(upper_bound, impl::upper_bound, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(equal_range, impl::equal_range, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(equal_range, impl::equal_range, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(mismatch, impl::mismatch, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(mismatch, impl::mismatch, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(binary_search, impl::binary_search, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(binary_search, impl::binary_search, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(includes, impl::includes, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(includes, impl::includes, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(min_element, impl::min_element, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(min_element, impl::min_element, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(max_element, impl::max_element, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(max_element, impl::max_element, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(lexicographical_compare, impl::lexicographical_compare, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(lexicographical_compare, impl::lexicographical_compare, 3)
}}
#endif

File diff suppressed because it is too large Load Diff