Files

67 lines
2.2 KiB
C++
Raw Permalink Normal View History

2007-10-21 00:52:09 +00:00
/*=============================================================================
2012-04-07 07:34:00 +00:00
Copyright (c) 2005-2012 Joel de Guzman
2007-10-21 00:52:09 +00:00
Copyright (c) 2005-2006 Dan Marsden
2012-04-07 09:56:07 +00:00
Distributed under the Boost Software License, Version 1.0. (See accompanying
2007-10-21 00:52:09 +00:00
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#if !defined(BOOST_FUSION_DEQUE_AT_IMPL_09122006_2017)
#define BOOST_FUSION_DEQUE_AT_IMPL_09122006_2017
2014-01-09 17:58:06 -08:00
#include <boost/fusion/support/config.hpp>
2007-10-21 00:52:09 +00:00
#include <boost/fusion/container/deque/detail/keyed_element.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/equal_to.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/add_reference.hpp>
2012-04-07 10:57:10 +00:00
namespace boost { namespace fusion
{
2007-10-21 00:52:09 +00:00
struct deque_tag;
2012-04-07 09:56:07 +00:00
namespace extension
2007-10-21 00:52:09 +00:00
{
template<typename T>
struct at_impl;
2012-04-07 09:56:07 +00:00
2007-10-21 00:52:09 +00:00
template<>
struct at_impl<deque_tag>
{
template<typename Sequence, typename N>
struct apply
{
typedef typename Sequence::next_up next_up;
typedef typename Sequence::next_down next_down;
BOOST_MPL_ASSERT_RELATION(next_down::value, !=, next_up::value);
2012-04-07 09:56:07 +00:00
static int const offset = next_down::value + 1;
typedef mpl::int_<(N::value + offset)> adjusted_index;
typedef typename
detail::keyed_element_value_at<Sequence, adjusted_index>::type
element_type;
2012-04-07 10:57:10 +00:00
typedef typename
add_reference<
typename mpl::eval_if<
is_const<Sequence>,
add_const<element_type>,
mpl::identity<element_type> >::type
>::type
type;
2007-10-21 00:52:09 +00:00
2015-03-03 02:21:02 +09:00
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
2007-10-21 00:52:09 +00:00
static type call(Sequence& seq)
{
return seq.get(adjusted_index());
}
};
};
}
}}
#endif