stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork

This commit is contained in:
2026-02-24 18:38:47 +00:00
parent da8c28aaeb
commit 65cb2619a7
13106 changed files with 2484322 additions and 1804 deletions
@@ -0,0 +1,17 @@
/*=============================================================================
Copyright (c) 2004 Angus Leeming
Copyright (c) 2006 Daniel Wallin
Copyright (c) 2005 Dan Marsden
Copyright (c) 2007 Joel de Guzman
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)
==============================================================================*/
#ifndef BOOST_PHOENIX_STL_ALGORITHM_HPP
#define BOOST_PHOENIX_STL_ALGORITHM_HPP
#include <boost/phoenix/stl/algorithm/iteration.hpp>
#include <boost/phoenix/stl/algorithm/querying.hpp>
#include <boost/phoenix/stl/algorithm/transformation.hpp>
#endif // BOOST_PHOENIX_STL_ALGORITHM_HPP
@@ -0,0 +1,30 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2015 John Fletcher.
//
// 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> is deprecated
#include <boost/range/iterator.hpp>
#include <boost/range/begin.hpp>
namespace boost { namespace phoenix {
namespace detail
{
template<class R>
typename range_iterator<R>::type
begin_(R& r)
{
return boost::begin(r);
}
}
}}
#endif
@@ -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
@@ -0,0 +1,30 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2015 John Fletcher.
//
// 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> is deprecated
#include <boost/range/iterator.hpp>
#include <boost/range/end.hpp>
namespace boost { namespace phoenix {
namespace detail
{
template<class R>
typename range_iterator<R>::type
end_(R& r)
{
return boost::end(r);
}
}
}}
#endif
@@ -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)
#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
@@ -0,0 +1,56 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2015 John Fletcher
//
// 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"
#include "./is_unordered_set_or_map.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>
>
, boost::mpl::or_<
is_std_unordered_map<T>
, is_std_unordered_multimap<T>
, is_std_unordered_set<T>
, is_std_unordered_multiset<T>
>
>
{
};
}
#endif
@@ -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)
#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
@@ -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
@@ -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)
#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
@@ -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)
#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
@@ -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
@@ -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)
#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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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)
# 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
@@ -0,0 +1,95 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2015 John Fletcher
//
// 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)
//
// This is based on is_std_hash_map.hpp which was
// modeled after range_ex, Copyright 2004 Eric Niebler
///////////////////////////////////////////////////////////////////////////////
//
// is_unordered_set_or_map.hpp
//
/////////////////////////////////////////////////////////////////////////////
// Definitions of overloads for the use of find with unordered types.
#ifndef BOOST_PHOENIX_IS_STD_UNORDERED_SET_OR_MAP
#define BOOST_PHOENIX_IS_STD_UNORDERED_SET_OR_MAP
#include <boost/mpl/bool.hpp>
#include "./std_unordered_set_or_map_fwd.hpp"
namespace boost
{
template<class T>
struct is_std_unordered_set
: boost::mpl::false_
{};
template<class T>
struct is_std_unordered_multiset
: boost::mpl::false_
{};
template<class T>
struct is_std_unordered_map
: boost::mpl::false_
{};
template<class T>
struct is_std_unordered_multimap
: boost::mpl::false_
{};
#ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP
template<
class Kty
, class Hash
, class Cmp
, class Alloc
>
struct is_std_unordered_set< std::unordered_set<Kty,Hash,Cmp,Alloc> >
: boost::mpl::true_
{};
template<
class Kty
, class Hash
, class Cmp
, class Alloc
>
struct is_std_unordered_multiset< std::unordered_multiset<Kty,Hash,Cmp,Alloc> >
: boost::mpl::true_
{};
template<
class Kty
, class Ty
, class Hash
, class Cmp
, class Alloc
>
struct is_std_unordered_map< std::unordered_map<Kty,Ty,Hash,Cmp,Alloc> >
: boost::mpl::true_
{};
template<
class Kty
, class Ty
, class Hash
, class Cmp
, class Alloc
>
struct is_std_unordered_multimap< std::unordered_multimap<Kty,Ty,Hash,Cmp,Alloc> >
: boost::mpl::true_
{};
#endif
} // namespace boost
#endif
@@ -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)
# 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/phoenix/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
@@ -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/phoenix/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
@@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2015 John Fletcher
//
// 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_unordered_set_or_map_fwd.hpp
//
/////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_PHOENIX_STD_UNORDERED_SET_OR_MAP_FWD
#define BOOST_PHOENIX_STD_UNORDERED_SET_OR_MAP_FWD
#include <boost/phoenix/config.hpp>
#ifdef BOOST_PHOENIX_HAS_UNORDERED_SET_AND_MAP
#if defined(BOOST_PHOENIX_USING_LIBCPP) \
|| (defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB < 540))
// Advance declaration not working for libc++ and MSVC 10
#include BOOST_PHOENIX_UNORDERED_SET_HEADER
#include BOOST_PHOENIX_UNORDERED_MAP_HEADER
#else
namespace std {
template<
class Kty
, class Hash
, class Cmp
, class Alloc
>
class unordered_set;
template<
class Kty
, class Hash
, class Cmp
, class Alloc
>
class unordered_multiset;
template<
class Kty
, class Ty
, class Hash
, class Cmp
, class Alloc
>
class unordered_map;
template<
class Kty
, class Ty
, class Hash
, class Cmp
, class Alloc
>
class unordered_multimap;
}
#endif
#endif
#endif
@@ -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
@@ -0,0 +1,660 @@
// Copyright 2005 Daniel Wallin.
// Copyright 2005 Joel de Guzman.
// Copyright 2005 Dan Marsden.
// Copyright 2008 Hartmut Kaiser.
// Copyright 2015 John Fletcher.
//
// 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> is deprecated
#include <boost/range/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&)>
: range_iterator<R>
{};
template<class R, class T>
typename range_iterator<R>::type
execute(R& r, T const& x, mpl::true_) const
{
return r.find(x);
}
template<class R, class T>
typename range_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_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_iterator<R>
{};
template<class R, class P>
typename range_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_iterator<R>
{};
template<typename This, class R, class R2, class P>
struct result<This(R&, R2&, P)>
: range_iterator<R>
{};
template<class R, class R2>
typename range_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_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_iterator<R>
{};
template<typename This, class R, class R2, class P>
struct result<This(R&, R2&, P)>
: range_iterator<R>
{};
template<class R, class R2>
typename range_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_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_iterator<R>
{};
template <typename This, class R, class P>
struct result<This(R&, P)>
: range_iterator<R>
{};
template<class R>
typename range_iterator<R>::type
operator()(R& r) const
{
return std::adjacent_find(detail::begin_(r), detail::end_(r));
}
template<class R, class P>
typename range_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&)>
: 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_iterator<R>
{};
template <typename This, class R, typename R2, class P>
struct result<This(R&, R2&, P)>
: range_iterator<R>
{};
template<class R, class R2>
typename range_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_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&)>
: range_iterator<R>
{};
template <typename This, class R, class T, class C>
struct result<This(R&, T&, C)>
: range_iterator<R>
{};
template<class R, class T>
typename range_iterator<R>::type
execute(R& r, T const& val, mpl::true_) const
{
return r.lower_bound(val);
}
template<class R, class T>
typename range_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_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_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&)>
: range_iterator<R>
{};
template <typename This, class R, class T, class C>
struct result<This(R&, T&, C)>
: range_iterator<R>
{};
template<class R, class T>
typename range_iterator<R>::type
execute(R& r, T const& val, mpl::true_) const
{
return r.upper_bound(val);
}
template<class R, class T>
typename range_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_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_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_iterator<R>::type
, typename range_iterator<R>::type
> type;
};
}
struct equal_range
{
template <typename Sig>
struct result;
template <typename This, class R, class T>
struct result<This(R&, T&)>
: result_of::equal_range<R,T>
{};
template <typename This, class R, class T, class C>
struct result<This(R&, T&, 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_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_iterator<R>
{};
template <typename This, class R, class P>
struct result<This(R&, P)>
: range_iterator<R>
{};
template<class R>
typename range_iterator<R>::type
operator()(R& r) const
{
return std::min_element(detail::begin_(r), detail::end_(r));
}
template<class R, class P>
typename range_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_iterator<R>
{};
template <typename This, class R, class P>
struct result<This(R&, P)>
: range_iterator<R>
{};
template<class R>
typename range_iterator<R>::type
operator()(R& r) const
{
return std::max_element(detail::begin_(r), detail::end_(r));
}
template<class R, class P>
typename range_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
@@ -0,0 +1,82 @@
/*==============================================================================
Copyright (c) 2011 Steven Watanabe
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)
==============================================================================*/
#ifndef BOOST_PHOENIX_CMATH_HPP_INCLUDED
#define BOOST_PHOENIX_CMATH_HPP_INCLUDED
#include <boost/phoenix/core/limits.hpp>
#include <cmath>
#include <boost/phoenix/function/adapt_callable.hpp>
#include <boost/type_traits/declval.hpp>
#include <boost/phoenix/support/iterate.hpp>
namespace boost {
#if (defined (BOOST_NO_CXX11_DECLTYPE) || \
defined (BOOST_INTEL_CXX_VERSION) || \
(BOOST_GCC_VERSION < 40500) )
#define BOOST_PHOENIX_MATH_FUNCTION_RESULT_TYPE(name, n) \
typename proto::detail::uncvref<A0>::type
#else
#define BOOST_PHOENIX_MATH_FUNCTION_RESULT_TYPE(name, n) \
decltype(name(BOOST_PP_ENUM_BINARY_PARAMS( \
n \
, boost::declval<typename proto::detail::uncvref<A \
, >::type>() BOOST_PP_INTERCEPT)))
#endif
#define BOOST_PHOENIX_MATH_FUNCTION(name, n) \
namespace phoenix_impl { \
struct name ## _impl { \
template<class Sig> \
struct result; \
template<class This, BOOST_PHOENIX_typename_A(n)> \
struct result<This(BOOST_PHOENIX_A(n))> \
{ \
typedef \
BOOST_PHOENIX_MATH_FUNCTION_RESULT_TYPE(name, n) \
type; \
}; \
template<BOOST_PHOENIX_typename_A(n)> \
typename result<name ## _impl(BOOST_PHOENIX_A(n))>::type \
operator()(BOOST_PHOENIX_A_const_ref_a(n)) const { \
using namespace std; \
return name(BOOST_PHOENIX_a(n)); \
} \
}; \
} \
namespace phoenix { \
BOOST_PHOENIX_ADAPT_CALLABLE(name, phoenix_impl::name ## _impl, n) \
}
BOOST_PHOENIX_MATH_FUNCTION(acos, 1)
BOOST_PHOENIX_MATH_FUNCTION(asin, 1)
BOOST_PHOENIX_MATH_FUNCTION(atan, 1)
BOOST_PHOENIX_MATH_FUNCTION(atan2, 2)
BOOST_PHOENIX_MATH_FUNCTION(ceil, 1)
BOOST_PHOENIX_MATH_FUNCTION(cos, 1)
BOOST_PHOENIX_MATH_FUNCTION(cosh, 1)
BOOST_PHOENIX_MATH_FUNCTION(exp, 1)
BOOST_PHOENIX_MATH_FUNCTION(fabs, 1)
BOOST_PHOENIX_MATH_FUNCTION(floor, 1)
BOOST_PHOENIX_MATH_FUNCTION(fmod, 2)
BOOST_PHOENIX_MATH_FUNCTION(frexp, 2)
BOOST_PHOENIX_MATH_FUNCTION(ldexp, 2)
BOOST_PHOENIX_MATH_FUNCTION(log, 1)
BOOST_PHOENIX_MATH_FUNCTION(log10, 1)
BOOST_PHOENIX_MATH_FUNCTION(modf, 2)
BOOST_PHOENIX_MATH_FUNCTION(pow, 2)
BOOST_PHOENIX_MATH_FUNCTION(sin, 1)
BOOST_PHOENIX_MATH_FUNCTION(sinh, 1)
BOOST_PHOENIX_MATH_FUNCTION(sqrt, 1)
BOOST_PHOENIX_MATH_FUNCTION(tan, 1)
BOOST_PHOENIX_MATH_FUNCTION(tanh, 1)
#undef BOOST_PHOENIX_MATH_FUNCTION
}
#endif
@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2004 Angus Leeming
Copyright (c) 2007 Joel de Guzman
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)
==============================================================================*/
#ifndef BOOST_PHOENIX_STL_CONTAINER_HPP
#define BOOST_PHOENIX_STL_CONTAINER_HPP
#include <boost/phoenix/stl/container/container.hpp>
#endif // BOOST_PHOENIX_STL_CONTAINER_HPP
@@ -0,0 +1,833 @@
/*=============================================================================
Copyright (c) 2004 Angus Leeming
Copyright (c) 2004 Joel de Guzman
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)
==============================================================================*/
#ifndef BOOST_PHOENIX_STL_CONTAINER_CONTAINER_HPP
#define BOOST_PHOENIX_STL_CONTAINER_CONTAINER_HPP
#include <boost/phoenix/core/limits.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/void.hpp>
#include <boost/phoenix/stl/container/detail/container.hpp>
#include <boost/phoenix/function/adapt_callable.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace phoenix
{
///////////////////////////////////////////////////////////////////////////////
//
// STL container member functions
//
// Lazy functions for STL container member functions
//
// These functions provide a mechanism for the lazy evaluation of the
// public member functions of the STL containers. For an overview of
// what is meant by 'lazy evaluation', see the comments in operators.hpp
// and functions.hpp.
//
// Lazy functions are provided for all of the member functions of the
// following containers:
//
// deque - list - map - multimap - vector.
//
// Indeed, should *your* class have member functions with the same names
// and signatures as those listed below, then it will automatically be
// supported. To summarize, lazy functions are provided for member
// functions:
//
// assign - at - back - begin - capacity - clear - empty - end -
// erase - front - get_allocator - insert - key_comp - max_size -
// pop_back - pop_front - push_back - push_front - rbegin - rend -
// reserve - resize . size - splice - value_comp.
//
// The lazy functions' names are the same as the corresponding member
// function. Sample usage:
//
// "Normal" version "Lazy" version
// ---------------- --------------
// my_vector.at(5) phoenix::at(arg1, 5)
// my_list.size() phoenix::size(arg1)
// my_vector1.swap(my_vector2) phoenix::swap(arg1, arg2)
//
// Notice that member functions with names that clash with a
// function in stl algorithms are absent. This will be provided
// in Phoenix's algorithm module.
//
// No support is provided here for lazy versions of operator+=,
// operator[] etc. Such operators are not specific to STL containers and
// lazy versions can therefore be found in operators.hpp.
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//
// Lazy member function implementaions.
//
// The structs below provide the guts of the implementation. Thereafter,
// the corresponding lazy function itself is simply:
//
// function<stl::assign> const assign = stl::assign();
//
// The structs provide a nested "result" class template whose
// "type" typedef enables the lazy function to ascertain the type
// to be returned when it is invoked.
//
// They also provide operator() member functions with signatures
// corresponding to those of the underlying member function of
// the STL container.
//
///////////////////////////////////////////////////////////////////////////////
namespace stl
{
struct assign
{
template <typename Sig>
struct result;
template <
typename This
, typename C
, typename Arg1
>
struct result<This(C&, Arg1&)>
{
typedef typename add_reference<C>::type type;
};
template <
typename This
, typename C
, typename Arg1
, typename Arg2
>
struct result<This(C&, Arg1, Arg2)>
{
typedef typename add_reference<C>::type type;
};
template <
typename This
, typename C
, typename Arg1
, typename Arg2
, typename Arg3
>
struct result<This(C&, Arg1, Arg2, Arg3)>
{
typedef typename add_reference<C>::type type;
};
template <typename C, typename Arg1>
C& operator()(C& c, Arg1 const & arg1) const
{
c.assign(arg1);
return c;
}
template <typename C, typename Arg1, typename Arg2>
C& operator()(C& c, Arg1 arg1, Arg2 arg2) const
{
c.assign(arg1, arg2);
return c;
}
template <typename C, typename Arg1, typename Arg2, typename Arg3>
C& operator()(
C& c
, Arg1 arg1
, Arg2 arg2
, Arg3 const & arg3
) const
{
return c.assign(arg1, arg2, arg3);
}
};
struct at_impl
{
template <typename Sig>
struct result;
template <typename This, typename C, typename Index>
struct result<This(C&, Index)>
{
//typedef typename const_qualified_reference_of<C>::type type;
typedef typename C::value_type & type;
};
template <typename C, typename Index>
typename result<at_impl(C&, Index const&)>::type
operator()(C& c, Index const &i) const
{
return c.at(i);
}
template <typename This, typename C, typename Index>
struct result<This(C const&, Index)>
{
typedef typename C::value_type const & type;
};
template <typename C, typename Index>
typename result<at_impl(C const&, Index const&)>::type
operator()(C const& c, Index const &i) const
{
return c.at(i);
}
};
struct back
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef
typename const_qualified_reference_of<C>::type
type;
};
template <typename C>
typename result<back(C&)>::type
operator()(C& c) const
{
return c.back();
}
};
struct begin
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename const_qualified_iterator_of<C>::type type;
};
template <typename C>
typename result<begin(C&)>::type
operator()(C& c) const
{
return c.begin();
}
};
struct capacity
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename size_type_of<C>::type type;
};
template <typename C>
typename result<capacity(C&)>::type
operator()(C const& c) const
{
return c.capacity();
}
};
struct clear
{
typedef void result_type;
template <typename C>
void operator()(C& c) const
{
return c.clear();
}
};
struct empty
{
typedef bool result_type;
template <typename C>
bool operator()(C const& c) const
{
return c.empty();
}
};
struct end
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename const_qualified_iterator_of<C>::type type;
};
template <typename C>
typename result<end(C&)>::type
operator()(C& c) const
{
return c.end();
}
};
namespace result_of
{
template <typename C, typename Arg1, typename Arg2 = mpl::void_>
struct erase
{
// BOOST_MSVC #if branch here in map_erase_result non-
// standard behavior. The return type should be void but
// VC7.1 prefers to return iterator_of<C>. As a result,
// VC7.1 complains of error C2562:
// boost::phoenix::stl::erase::operator() 'void' function
// returning a value. Oh well... :*
typedef
boost::mpl::eval_if_c<
boost::is_same<
typename remove_reference<Arg1>::type
, typename iterator_of<C>::type
>::value
#if defined(BOOST_MSVC)// && (BOOST_MSVC <= 1500)
, iterator_of<C>
#else
, boost::mpl::identity<void>
#endif
, size_type_of<C>
>
map_erase_result;
typedef typename
boost::mpl::eval_if_c<
has_mapped_type<C>::value
, map_erase_result
, iterator_of<C>
>::type
type;
};
}
struct erase
{
// This mouthful can differentiate between the generic erase
// functions (Container == std::deque, std::list, std::vector) and
// that specific to the two map-types, std::map and std::multimap.
//
// where C is a std::deque, std::list, std::vector:
//
// 1) iterator C::erase(iterator where);
// 2) iterator C::erase(iterator first, iterator last);
//
// where M is a std::map or std::multimap:
//
// 3) size_type M::erase(const Key& keyval);
// 4) void M::erase(iterator where);
// 5) void M::erase(iterator first, iterator last);
template <typename Sig>
struct result;
template <typename This, typename C, typename Arg1>
struct result<This(C&, Arg1)>
: result_of::erase<C, Arg1>
{};
template <typename This, typename C, typename Arg1, typename Arg2>
struct result<This(C&, Arg1, Arg2)>
: result_of::erase<C, Arg1, Arg2>
{};
template <typename C, typename Arg1>
typename result_of::erase<C, Arg1>::type
operator()(C& c, Arg1 arg1) const
{
typedef typename result_of::erase<C, Arg1>::type result_type;
return static_cast<result_type>(c.erase(arg1));
}
template <typename C, typename Arg1, typename Arg2>
typename result_of::erase<C, Arg1, Arg2>::type
operator()(C& c, Arg1 arg1, Arg2 arg2) const
{
typedef typename result_of::erase<C, Arg1, Arg2>::type result_type;
return static_cast<result_type>(c.erase(arg1, arg2));
}
};
struct front
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename const_qualified_reference_of<C>::type type;
};
template <typename C>
typename result<front(C&)>::type
operator()(C& c) const
{
return c.front();
}
};
struct get_allocator
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename allocator_type_of<C>::type type;
};
template <typename C>
typename result<get_allocator(C const&)>::type
operator()(C& c) const
{
return c.get_allocator();
}
};
namespace result_of
{
template <
typename C
, typename Arg1
, typename Arg2 = mpl::void_
, typename Arg3 = mpl::void_
>
class insert
{
struct pair_iterator_bool
{
typedef typename std::pair<typename C::iterator, bool> type;
};
typedef
boost::mpl::eval_if<
map_insert_returns_pair<typename remove_const<C>::type>
, pair_iterator_bool
, iterator_of<C>
>
choice_1;
typedef
boost::mpl::eval_if_c<
boost::mpl::and_<
boost::is_same<Arg3, mpl::void_>
, boost::mpl::not_<boost::is_same<Arg1, Arg2> >
>::value
, iterator_of<C>
, boost::mpl::identity<void>
>
choice_2;
public:
typedef typename
boost::mpl::eval_if_c<
boost::is_same<Arg2, mpl::void_>::value
, choice_1
, choice_2
>::type
type;
};
}
struct insert
{
// This mouthful can differentiate between the generic insert
// functions (Container == deque, list, vector) and those
// specific to the two map-types, std::map and std::multimap.
//
// where C is a std::deque, std::list, std::vector:
//
// 1) iterator C::insert(iterator where, value_type value);
// 2) void C::insert(
// iterator where, size_type count, value_type value);
// 3) template <typename Iter>
// void C::insert(iterator where, Iter first, Iter last);
//
// where M is a std::map and MM is a std::multimap:
//
// 4) pair<iterator, bool> M::insert(value_type const&);
// 5) iterator MM::insert(value_type const&);
//
// where M is a std::map or std::multimap:
//
// 6) template <typename Iter>
// void M::insert(Iter first, Iter last);
template <typename Sig>
struct result;
template <
typename This
, typename C
, typename Arg1
>
struct result<This(C &, Arg1)>
: result_of::insert<C, Arg1>
{};
template <
typename This
, typename C
, typename Arg1
, typename Arg2
>
struct result<This(C &, Arg1, Arg2)>
: result_of::insert<C, Arg1, Arg2>
{};
template <
typename This
, typename C
, typename Arg1
, typename Arg2
, typename Arg3
>
struct result<This(C &, Arg1, Arg2, Arg3)>
: result_of::insert<C, Arg1, Arg2, Arg3>
{};
template <typename C, typename Arg1>
typename result<insert(C&, Arg1)>::type
operator()(C& c, Arg1 arg1) const
{
return c.insert(arg1);
}
template <typename C, typename Arg1, typename Arg2>
typename result<insert(C&, Arg1, Arg2)>::type
operator()(C& c, Arg1 arg1, Arg2 arg2) const
{
typedef typename result<insert(C&, Arg1, Arg2)>::type result_type;
return static_cast<result_type>(c.insert(arg1, arg2));
}
template <typename C, typename Arg1, typename Arg2, typename Arg3>
typename result<insert(C&, Arg1, Arg2, Arg3)>::type
operator()(C& c, Arg1 arg1, Arg2 arg2, Arg3 arg3) const
{
typedef typename result<insert(C&, Arg1, Arg2, Arg3)>::type result_type;
return static_cast<result_type>(c.insert(arg1, arg2, arg3));
}
};
namespace result_of
{
template <typename C>
struct key_comp
{
typedef typename key_compare_of<C>::type type;
};
}
struct key_comp
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
: result_of::key_comp<C>
{};
template <typename C>
typename result_of::key_comp<C>::type
operator()(C& c) const
{
return c.key_comp();
}
};
struct max_size
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename size_type_of<C>::type type;
};
template <typename C>
typename result<max_size(C const&)>::type
operator()(C& c) const
{
return c.max_size();
}
};
struct pop_back
{
typedef void result_type;
template <typename C>
void operator()(C& c) const
{
return c.pop_back();
}
};
struct pop_front
{
typedef void result_type;
template <typename C>
void operator()(C& c) const
{
return c.pop_front();
}
};
struct push_back
{
typedef void result_type;
template <typename C, typename Arg>
void operator()(C& c, Arg const& data) const
{
return c.push_back(data);
}
};
struct push_front
{
typedef void result_type;
template <typename C, typename Arg>
void operator()(C& c, Arg const& data) const
{
return c.push_front(data);
}
};
struct rbegin
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename
const_qualified_reverse_iterator_of<C>::type
type;
};
template <typename C>
typename result<rbegin(C&)>::type
operator()(C& c) const
{
return c.rbegin();
}
};
struct rend
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename
const_qualified_reverse_iterator_of<C>::type
type;
};
template <typename C>
typename result<rend(C&)>::type
operator()(C& c) const
{
return c.rend();
}
};
struct reserve
{
typedef void result_type;
template <typename C, typename Arg>
void operator()(C& c, Arg const& count) const
{
c.reserve(count);
}
};
struct resize
{
typedef void result_type;
template <typename C, typename Arg1>
void operator()(C& c, Arg1 const& arg1) const
{
c.resize(arg1);
}
template <typename C, typename Arg1, typename Arg2>
void operator()(C& c, Arg1 const& arg1, Arg2 const& arg2) const
{
c.resize(arg1, arg2);
}
};
struct size
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
{
typedef typename size_type_of<C>::type type;
};
template <typename C>
typename result<size(C&)>::type
operator()(C& c) const
{
return c.size();
}
};
struct splice
{
typedef void result_type;
template <typename C, typename Arg1, typename Arg2>
void operator()(C& c, Arg1 arg1, Arg2 &arg2) const
{
c.splice(arg1, arg2);
}
template <
typename C
, typename Arg1
, typename Arg2
, typename Arg3
>
void operator()(
C& c
, Arg1 arg1
, Arg2 & arg2
, Arg3 arg3
) const
{
c.splice(arg1, arg2, arg3);
}
template <
typename C
, typename Arg1
, typename Arg2
, typename Arg3
, typename Arg4
>
void operator()(
C c
, Arg1 arg1
, Arg2 & arg2
, Arg3 arg3
, Arg4 arg4
) const
{
c.splice(arg1, arg2, arg3, arg4);
}
};
namespace result_of
{
template <typename C>
struct value_comp
{
typedef typename value_compare_of<C>::type type;
};
}
struct value_comp
{
template <typename Sig>
struct result;
template <typename This, typename C>
struct result<This(C&)>
: result_of::value_comp<C>
{};
template <typename C>
typename result_of::value_comp<C>::type
operator()(C& c) const
{
return c.value_comp();
}
};
} // namespace stl
///////////////////////////////////////////////////////////////////////////////
//
// The lazy functions themselves.
//
///////////////////////////////////////////////////////////////////////////////
namespace adl_barrier
{
BOOST_PHOENIX_ADAPT_CALLABLE(assign, boost::phoenix::stl::assign, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(assign, boost::phoenix::stl::assign, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(assign, boost::phoenix::stl::assign, 4)
BOOST_PHOENIX_ADAPT_CALLABLE(at, ::boost::phoenix::stl::at_impl, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(back, stl::back, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(begin, stl::begin, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(capacity, stl::capacity, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(clear, stl::clear, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(empty, stl::empty, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(end, stl::end, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(erase, stl::erase, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(erase, stl::erase, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(front, stl::front, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(get_allocator, stl::get_allocator, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(insert, stl::insert, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(insert, stl::insert, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(insert, stl::insert, 4)
BOOST_PHOENIX_ADAPT_CALLABLE(key_comp, stl::key_comp, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(max_size, stl::max_size, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(pop_back, stl::pop_back, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(pop_front, stl::pop_front, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(push_back, stl::push_back, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(push_front, stl::push_front, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(rbegin, stl::rbegin, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(rend, stl::rend, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(reserve, stl::reserve, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(resize, stl::resize, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(resize, stl::resize, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(size, stl::size, 1)
BOOST_PHOENIX_ADAPT_CALLABLE(splice, stl::splice, 2)
BOOST_PHOENIX_ADAPT_CALLABLE(splice, stl::splice, 3)
BOOST_PHOENIX_ADAPT_CALLABLE(splice, stl::splice, 4)
BOOST_PHOENIX_ADAPT_CALLABLE(splice, stl::splice, 5)
BOOST_PHOENIX_ADAPT_CALLABLE(value_comp, stl::value_comp, 1)
}
using namespace phoenix::adl_barrier;
}} // namespace boost::phoenix
#endif // BOOST_PHOENIX_STL_CONTAINERS_HPP
@@ -0,0 +1,173 @@
/*=============================================================================
Copyright (c) 2004 Angus Leeming
Copyright (c) 2004 Joel de Guzman
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)
==============================================================================*/
#ifndef BOOST_PHOENIX_CONTAINER_DETAIL_CONTAINER_HPP
#define BOOST_PHOENIX_CONTAINER_DETAIL_CONTAINER_HPP
#include <utility>
#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_const.hpp>
namespace boost { namespace phoenix { namespace stl
{
///////////////////////////////////////////////////////////////////////////////
//
// Metafunctions "value_type_of", "key_type_of" etc.
//
// These metafunctions define a typedef "type" that returns the nested
// type if it exists. If not then the typedef returns void.
//
// For example, "value_type_of<std::vector<int> >::type" is "int" whilst
// "value_type_of<double>::type" is "void".
//
// I use a macro to define structs "value_type_of" etc simply to cut
// down on the amount of code. The macro is #undef-ed immediately after
// its final use.
//
/////////////////////////////////////////////////////////////////c//////////////
#define MEMBER_TYPE_OF(MEMBER_TYPE) \
template <typename C> \
struct BOOST_PP_CAT(MEMBER_TYPE, _of) \
{ \
typedef typename C::MEMBER_TYPE type; \
}
MEMBER_TYPE_OF(allocator_type);
MEMBER_TYPE_OF(const_iterator);
MEMBER_TYPE_OF(const_reference);
MEMBER_TYPE_OF(const_reverse_iterator);
MEMBER_TYPE_OF(container_type);
MEMBER_TYPE_OF(data_type);
MEMBER_TYPE_OF(iterator);
MEMBER_TYPE_OF(key_compare);
MEMBER_TYPE_OF(key_type);
MEMBER_TYPE_OF(reference);
MEMBER_TYPE_OF(reverse_iterator);
MEMBER_TYPE_OF(size_type);
MEMBER_TYPE_OF(value_compare);
MEMBER_TYPE_OF(value_type);
#undef MEMBER_TYPE_OF
///////////////////////////////////////////////////////////////////////////////
//
// Const-Qualified types.
//
// Many of the stl member functions have const and non-const
// overloaded versions that return distinct types. For example:
//
// iterator begin();
// const_iterator begin() const;
//
// The three class templates defined below,
// const_qualified_reference_of, const_qualified_iterator_of
// and const_qualified_reverse_iterator_of provide a means to extract
// this return type automatically.
//
///////////////////////////////////////////////////////////////////////////////
template <typename C>
struct const_qualified_reference_of
{
typedef typename
boost::mpl::eval_if_c<
boost::is_const<C>::value
, const_reference_of<C>
, reference_of<C>
>::type
type;
};
template <typename C>
struct const_qualified_iterator_of
{
typedef typename
boost::mpl::eval_if_c<
boost::is_const<C>::value
, const_iterator_of<C>
, iterator_of<C>
>::type
type;
};
template <typename C>
struct const_qualified_reverse_iterator_of
{
typedef typename
boost::mpl::eval_if_c<
boost::is_const<C>::value
, const_reverse_iterator_of<C>
, reverse_iterator_of<C>
>::type
type;
};
///////////////////////////////////////////////////////////////////////////////
//
// has_mapped_type<C>
//
// Given a container C, determine if it is a map or multimap
// by checking if it has a member type named "mapped_type".
//
///////////////////////////////////////////////////////////////////////////////
namespace stl_impl
{
struct one { char a[1]; };
struct two { char a[2]; };
template <typename C>
one has_mapped_type(typename C::mapped_type(*)());
template <typename C>
two has_mapped_type(...);
}
template <typename C>
struct has_mapped_type
: boost::mpl::bool_<
sizeof(stl_impl::has_mapped_type<C>(0)) == sizeof(stl_impl::one)
>
{};
///////////////////////////////////////////////////////////////////////////////
//
// map_insert_returns_pair<C>
//
// Distinguish a map from a multimap by checking the return type
// of its "insert" member function. A map returns a pair while
// a multimap returns an iterator.
//
///////////////////////////////////////////////////////////////////////////////
namespace stl_impl
{
// Cool implementation of map_insert_returns_pair by Daniel Wallin.
// Thanks Daniel!!! I owe you a Pizza!
template<class A, class B>
one map_insert_returns_pair_check(std::pair<A,B> const&);
template <typename T>
two map_insert_returns_pair_check(T const&);
template <typename C>
struct map_insert_returns_pair
{
static typename C::value_type const& get;
BOOST_STATIC_CONSTANT(int,
value = sizeof(
map_insert_returns_pair_check(((C*)0)->insert(get))));
typedef boost::mpl::bool_<value == sizeof(one)> type;
};
}
template <typename C>
struct map_insert_returns_pair
: stl_impl::map_insert_returns_pair<C>::type {};
}}} // namespace boost::phoenix::stl
#endif // BOOST_PHOENIX_STL_CONTAINER_TRAITS_HPP