/usr/include/boost/proto/detail
Edit: /usr/include/boost/proto/detail/deduce_domain.hpp (6829B)
///////////////////////////////////////////////////////////////////////////////
/// \file deduce_domain.hpp
/// Contains definition of deduce_domain\<\> class templates
/// for finding the domain that is common among the specified
/// domains
//
// Copyright 2010 Daniel Wallin, Eric Niebler. 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)
//
// Many thanks to Daniel Wallin who first implemented this code. Thanks
// also to Jeremiah Willcock, John Bytheway and Krishna Achuthan who
// offered alternate solutions to this tricky programming problem.
#ifndef BOOST_PROTO_DEDUCE_DOMAIN_HPP_EAN_05_22_2010
#define BOOST_PROTO_DEDUCE_DOMAIN_HPP_EAN_05_22_2010
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#ifndef BOOST_PROTO_ASSERT_VALID_DOMAIN
# define BOOST_PROTO_ASSERT_VALID_DOMAIN(DOM) BOOST_MPL_ASSERT_NOT((boost::is_same))
#endif
namespace boost
{
namespace proto
{
namespace detail
{
template
struct domain_
: domain_
{
typedef Domain type;
typedef domain_ base;
#ifdef BOOST_NO_CXX11_DECLTYPE
using base::deduce98;
static int const index = base::index + 1;
static typename sized_type::type deduce98(domain_*);
#else
using base::deduce0x;
static Domain deduce0x(domain_*);
#endif
};
template<>
struct domain_
{
typedef not_a_domain type;
#ifdef BOOST_NO_CXX11_DECLTYPE
static int const index = 1;
static sized_type<1>::type deduce98(void*);
#else
static not_a_domain deduce0x(void*);
#endif
};
template<>
struct domain_
: domain_
{};
template<>
struct domain_
: domain_
{};
sized_type<1>::type default_test(void*, void*);
sized_type<2>::type default_test(domain_*, void*);
sized_type<2>::type default_test(domain_*, void*);
sized_type<3>::type default_test(void*, domain_*);
sized_type<3>::type default_test(void*, domain_*);
sized_type<4>::type default_test(domain_*, domain_*);
sized_type<4>::type default_test(domain_*, domain_*);
sized_type<4>::type default_test(domain_*, domain_*);
sized_type<4>::type default_test(domain_*, domain_*);
#ifdef BOOST_NO_CXX11_DECLTYPE
template
struct nth_domain
: nth_domain
{};
template
struct nth_domain<0, Domain>
: Domain
{};
#endif
template
struct common_domain1
{
typedef D0 type;
};
template
struct deduce_domain1
: domain_of
{};
template<
typename D0
, typename D1
, int DefaultCase = sizeof(proto::detail::default_test((domain_*)0, (domain_*)0))
>
struct common_domain2
{
#ifdef BOOST_NO_CXX11_DECLTYPE
static int const index = domain_::index - sizeof(domain_::deduce98((domain_*)0));
typedef typename nth_domain >::type type;
#else
typedef decltype(domain_::deduce0x((domain_*)0)) type;
#endif
};
template
struct common_domain2
{
typedef D1 type;
};
template
struct common_domain2
{
typedef D0 type;
};
template
struct common_domain2
{
typedef D0 type;
};
template
struct common_domain2
{
typedef D0 type;
};
template
struct common_domain2
{
typedef D1 type;
};
template
struct common_domain2
{
typedef D1 type;
};
template<>
struct common_domain2
{
typedef default_domain type;
};
template<>
struct common_domain2
{
typedef default_domain type;
};
template<>
struct common_domain2
{
typedef default_domain type;
};
template<>
struct common_domain2
{
typedef basic_default_domain type;
};
template
struct deduce_domain2
: common_domain2<
typename domain_of::type
, typename domain_of::type
>
{};
#include
}
}
}
#endif // BOOST_PROTO_DEDUCE_DOMAIN_HPP_EAN_05_22_2010