119 lines
3.2 KiB
C++
119 lines
3.2 KiB
C++
// Copyright Daniel Wallin 2006.
|
|
// 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 ACTIV_BOOST_PARAMETER_SET_060912_HPP
|
|
#define ACTIV_BOOST_PARAMETER_SET_060912_HPP
|
|
|
|
#include <ActivBoost/parameter/config.hpp>
|
|
|
|
#if defined(ACTIV_BOOST_PARAMETER_CAN_USE_MP11)
|
|
#include <ActivBoost/mp11/list.hpp>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
typedef ::Boost::mp11::mp_list<> set0;
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#include <ActivBoost/mp11/algorithm.hpp>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
template <typename S, typename K>
|
|
struct insert_
|
|
{
|
|
using type = ::Boost::mp11::mp_insert_c<S,0,K>;
|
|
};
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#include <ActivBoost/mp11/integral.hpp>
|
|
#include <ActivBoost/mp11/utility.hpp>
|
|
#include <type_traits>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
template <typename Set, typename K>
|
|
struct has_key_
|
|
{
|
|
using type = ::Boost::mp11::mp_if<
|
|
::Boost::mp11::mp_empty<Set>
|
|
, ::Boost::mp11::mp_false
|
|
, ::std::is_same<
|
|
::Boost::mp11::mp_find<Set,K>
|
|
, ::Boost::mp11::mp_size<Set>
|
|
>
|
|
>;
|
|
};
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#elif ACTIV_BOOST_WORKAROUND(ACTIV_BOOST_BORLANDC, ACTIV_BOOST_TESTED_AT(0x564))
|
|
#include <ActivBoost/mpl/list.hpp>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
typedef ::Boost::mpl::list0<> set0;
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#include <ActivBoost/mpl/push_front.hpp>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
template <typename Set, typename K>
|
|
struct insert_ : ::Boost::mpl::push_front<Set,K>
|
|
{
|
|
};
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#include <ActivBoost/mpl/bool.hpp>
|
|
#include <ActivBoost/mpl/if.hpp>
|
|
#include <ActivBoost/mpl/end.hpp>
|
|
#include <ActivBoost/mpl/find.hpp>
|
|
#include <ActivBoost/type_traits/is_same.hpp>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
template <typename Set, typename K>
|
|
struct has_key_
|
|
{
|
|
typedef typename ::Boost::mpl::find<Set,K>::type iter;
|
|
typedef typename ::Boost::mpl::if_<
|
|
::Boost::is_same<iter,typename ::Boost::mpl::end<Set>::type>
|
|
, ::Boost::mpl::false_
|
|
, ::Boost::mpl::true_
|
|
>::type type;
|
|
};
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#else // !ACTIV_BOOST_PARAMETER_CAN_USE_MP11 && Borland workarounds not needed
|
|
#include <ActivBoost/mpl/set/set0.hpp>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
typedef ::Boost::mpl::set0<> set0;
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#include <ActivBoost/mpl/insert.hpp>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
template <typename Set, typename K>
|
|
struct insert_ : ::Boost::mpl::insert<Set,K>
|
|
{
|
|
};
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#include <ActivBoost/mpl/has_key.hpp>
|
|
|
|
namespace Boost { namespace parameter { namespace aux {
|
|
|
|
template <typename Set, typename K>
|
|
struct has_key_ : ::Boost::mpl::has_key<Set,K>
|
|
{
|
|
};
|
|
}}} // namespace Boost::parameter::aux
|
|
|
|
#endif // ACTIV_BOOST_PARAMETER_CAN_USE_MP11 || Borland workarounds needed
|
|
#endif // include guard
|
|
|