mirror of
https://github.com/boostorg/fusion.git
synced 2025-09-26 17:00:56 +02:00
23
include/boost/fusion/adapted/std_array.hpp
Normal file
23
include/boost/fusion/adapted/std_array.hpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013 Mateusz Loskot
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY__01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY__01062013_1700
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/std_array/std_array_iterator.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/tag_of.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/is_view_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/is_sequence_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/category_of_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/begin_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/end_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/size_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/at_impl.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/value_at_impl.hpp>
|
||||||
|
|
||||||
|
#endif
|
25
include/boost/fusion/adapted/std_array/detail/array_size.hpp
Normal file
25
include/boost/fusion/adapted/std_array/detail/array_size.hpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013 Mateusz Loskot
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_ARRAY_SIZE_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_ARRAY_SIZE_01062013_1700
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<class T>
|
||||||
|
struct std_array_size;
|
||||||
|
|
||||||
|
template<template<typename, std::size_t> class Array, typename T, std::size_t N>
|
||||||
|
struct std_array_size<Array<T, N>> : std::integral_constant<std::size_t, N> {};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
45
include/boost/fusion/adapted/std_array/detail/at_impl.hpp
Normal file
45
include/boost/fusion/adapted/std_array/detail/at_impl.hpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_AT_IMPL_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_AT_IMPL_01062013_1700
|
||||||
|
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct at_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct at_impl<std_array_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename mpl::if_<
|
||||||
|
is_const<Sequence>,
|
||||||
|
typename Sequence::const_reference,
|
||||||
|
typename Sequence::reference>::type type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& seq)
|
||||||
|
{
|
||||||
|
return seq[N::value];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
41
include/boost/fusion/adapted/std_array/detail/begin_impl.hpp
Normal file
41
include/boost/fusion/adapted/std_array/detail/begin_impl.hpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013 Mateusz Loskot
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_BEGIN_OF_IMPL_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_BEGIN_OF_IMPL_01062013_1700
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/std_array/std_array_iterator.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct begin_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct begin_impl<std_array_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef std_array_iterator<Sequence, 0> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@@ -0,0 +1,35 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_CATEGORY_OF_IMPL_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_CATEGORY_OF_IMPL_01062013_1700
|
||||||
|
|
||||||
|
#include <boost/config/no_tr1/utility.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_array_tag;
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct category_of_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct category_of_impl<std_array_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef random_access_traversal_tag type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
45
include/boost/fusion/adapted/std_array/detail/end_impl.hpp
Normal file
45
include/boost/fusion/adapted/std_array/detail/end_impl.hpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013 Mateusz Loskot
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_END_OF_IMPL_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_END_OF_IMPL_01062013_1700
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/std_array/std_array_iterator.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/array_size.hpp>
|
||||||
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template <typename Tag>
|
||||||
|
struct end_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct end_impl<std_array_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename remove_const<Sequence>::type seq_type;
|
||||||
|
static int const size = std_array_size<seq_type>::value;
|
||||||
|
typedef std_array_iterator<Sequence, size> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Sequence& v)
|
||||||
|
{
|
||||||
|
return type(v);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013 Mateusz Loskot
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_IS_SEQUENCE_IMPL_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_IS_SEQUENCE_IMPL_01062013_1700
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_sequence_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_sequence_impl<std_array_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply : mpl::true_ {};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@@ -0,0 +1,33 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013 Mateusz Loskot
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_IS_VIEW_IMPL_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_IS_VIEW_IMPL_01062013_1700
|
||||||
|
|
||||||
|
#include <boost/mpl/bool.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct std_array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename Tag>
|
||||||
|
struct is_view_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct is_view_impl<std_array_tag>
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct apply : mpl::false_
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
41
include/boost/fusion/adapted/std_array/detail/size_impl.hpp
Normal file
41
include/boost/fusion/adapted/std_array/detail/size_impl.hpp
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013 Mateusz Loskot
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_SIZE_IMPL_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_SIZE_IMPL_01062013_1700
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/array_size.hpp>
|
||||||
|
#include <boost/type_traits/remove_const.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct size_impl;
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct size_impl<std_array_tag>
|
||||||
|
{
|
||||||
|
template<typename Sequence>
|
||||||
|
struct apply
|
||||||
|
: mpl::int_
|
||||||
|
<
|
||||||
|
std_array_size
|
||||||
|
<
|
||||||
|
typename remove_const<Sequence>::type
|
||||||
|
>::value
|
||||||
|
>
|
||||||
|
{};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@@ -0,0 +1,32 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_VALUE_AT_IMPL_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_VALUE_AT_IMPL_01062013_1700
|
||||||
|
|
||||||
|
namespace boost { namespace fusion {
|
||||||
|
|
||||||
|
struct std_array_tag;
|
||||||
|
|
||||||
|
namespace extension
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
struct value_at_impl;
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct value_at_impl<std_array_tag>
|
||||||
|
{
|
||||||
|
template <typename Sequence, typename N>
|
||||||
|
struct apply
|
||||||
|
{
|
||||||
|
typedef typename Sequence::value_type type;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
109
include/boost/fusion/adapted/std_array/std_array_iterator.hpp
Normal file
109
include/boost/fusion/adapted/std_array/std_array_iterator.hpp
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2013 Mateusz Loskot
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_ARRAY_ITERATOR_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_ARRAY_ITERATOR_01062013_1700
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#include <boost/mpl/int.hpp>
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
#include <boost/mpl/if.hpp>
|
||||||
|
#include <boost/mpl/minus.hpp>
|
||||||
|
#include <boost/type_traits/is_const.hpp>
|
||||||
|
#include <boost/fusion/iterator/iterator_facade.hpp>
|
||||||
|
#include <boost/fusion/adapted/std_array/detail/array_size.hpp>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct random_access_traversal_tag;
|
||||||
|
|
||||||
|
template <typename Array, int Pos>
|
||||||
|
struct std_array_iterator
|
||||||
|
: iterator_facade<std_array_iterator<Array, Pos>, random_access_traversal_tag>
|
||||||
|
{
|
||||||
|
BOOST_MPL_ASSERT_RELATION(Pos, >=, 0);
|
||||||
|
BOOST_MPL_ASSERT_RELATION(Pos, <=, std::tuple_size<Array>::value);
|
||||||
|
|
||||||
|
typedef mpl::int_<Pos> index;
|
||||||
|
typedef Array array_type;
|
||||||
|
|
||||||
|
std_array_iterator(Array& a)
|
||||||
|
: array(a) {}
|
||||||
|
|
||||||
|
Array& array;
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct value_of
|
||||||
|
{
|
||||||
|
typedef typename Iterator::array_type array_type;
|
||||||
|
typedef typename array_type::value_type type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct deref
|
||||||
|
{
|
||||||
|
typedef typename Iterator::array_type array_type;
|
||||||
|
typedef typename
|
||||||
|
mpl::if_<
|
||||||
|
is_const<array_type>
|
||||||
|
, typename array_type::const_reference
|
||||||
|
, typename array_type::reference
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const & it)
|
||||||
|
{
|
||||||
|
return it.array[Iterator::index::value];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator, typename N>
|
||||||
|
struct advance
|
||||||
|
{
|
||||||
|
typedef typename Iterator::index index;
|
||||||
|
typedef typename Iterator::array_type array_type;
|
||||||
|
typedef std_array_iterator<array_type, index::value + N::value> type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(Iterator const& i)
|
||||||
|
{
|
||||||
|
return type(i.array);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct next : advance<Iterator, mpl::int_<1> > {};
|
||||||
|
|
||||||
|
template <typename Iterator>
|
||||||
|
struct prior : advance<Iterator, mpl::int_<-1> > {};
|
||||||
|
|
||||||
|
template <typename I1, typename I2>
|
||||||
|
struct distance : mpl::minus<typename I2::index, typename I1::index>
|
||||||
|
{
|
||||||
|
typedef typename
|
||||||
|
mpl::minus<
|
||||||
|
typename I2::index, typename I1::index
|
||||||
|
>::type
|
||||||
|
type;
|
||||||
|
|
||||||
|
static type
|
||||||
|
call(I1 const&, I2 const&)
|
||||||
|
{
|
||||||
|
return type();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
std_array_iterator<Array, Pos>& operator=(std_array_iterator<Array, Pos> const&);
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
52
include/boost/fusion/adapted/std_array/tag_of.hpp
Normal file
52
include/boost/fusion/adapted/std_array/tag_of.hpp
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*=============================================================================
|
||||||
|
Copyright (c) 2001-2011 Joel de Guzman
|
||||||
|
Copyright (c) 2005-2006 Dan Marsden
|
||||||
|
|
||||||
|
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)
|
||||||
|
==============================================================================*/
|
||||||
|
#if !defined(BOOST_FUSION_STD_ARRAY_TAG_OF_01062013_1700)
|
||||||
|
#define BOOST_FUSION_STD_ARRAY_TAG_OF_01062013_1700
|
||||||
|
|
||||||
|
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||||
|
#include <array>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
|
namespace boost { namespace fusion
|
||||||
|
{
|
||||||
|
struct std_array_tag;
|
||||||
|
struct fusion_sequence_tag;
|
||||||
|
|
||||||
|
namespace traits
|
||||||
|
{
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
|
||||||
|
struct tag_of<std::array<T,N>, void >
|
||||||
|
#else
|
||||||
|
struct tag_of<std::array<T,N> >
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
typedef std_array_tag type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
namespace boost { namespace mpl
|
||||||
|
{
|
||||||
|
template<typename>
|
||||||
|
struct sequence_tag;
|
||||||
|
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
struct sequence_tag<std::array<T,N> >
|
||||||
|
{
|
||||||
|
typedef fusion::fusion_sequence_tag type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
struct sequence_tag<std::array<T,N> const>
|
||||||
|
{
|
||||||
|
typedef fusion::fusion_sequence_tag type;
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
@@ -1,5 +1,6 @@
|
|||||||
##==============================================================================
|
##==============================================================================
|
||||||
# Copyright (c) 2003-2006 Joel de Guzman
|
# Copyright (c) 2003-2006 Joel de Guzman
|
||||||
|
# Copyright (c) 2013 Mateusz Loskot
|
||||||
#
|
#
|
||||||
# Use, modification and distribution is subject to the Boost Software
|
# Use, modification and distribution is subject to the Boost Software
|
||||||
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
@@ -121,6 +122,7 @@ project
|
|||||||
[ run sequence/std_pair.cpp : : : : ]
|
[ run sequence/std_pair.cpp : : : : ]
|
||||||
[ run sequence/boost_array.cpp : : : : ]
|
[ run sequence/boost_array.cpp : : : : ]
|
||||||
[ run sequence/array.cpp : : : : ]
|
[ run sequence/array.cpp : : : : ]
|
||||||
|
[ run sequence/std_array.cpp : : : : ]
|
||||||
[ run sequence/tuple_comparison.cpp : : : : ]
|
[ run sequence/tuple_comparison.cpp : : : : ]
|
||||||
[ run sequence/tuple_construction.cpp : : : : ]
|
[ run sequence/tuple_construction.cpp : : : : ]
|
||||||
[ run sequence/tuple_conversion.cpp : : : : ]
|
[ run sequence/tuple_conversion.cpp : : : : ]
|
||||||
|
49
test/sequence/std_array.cpp
Normal file
49
test/sequence/std_array.cpp
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
//
|
||||||
|
// Copyright (C) 2013 Mateusz Loskot <mateusz@loskot.net>
|
||||||
|
//
|
||||||
|
// 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)
|
||||||
|
//
|
||||||
|
#include <boost/config.hpp>
|
||||||
|
#ifdef BOOST_NO_CXX11_HDR_ARRAY
|
||||||
|
int main() {}
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifdef BOOST_MSVC
|
||||||
|
#pragma warning(disable:4180)
|
||||||
|
#endif
|
||||||
|
#include <boost/detail/lightweight_test.hpp>
|
||||||
|
|
||||||
|
#include <boost/fusion/adapted/std_array.hpp>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
#include <boost/fusion/sequence/intrinsic.hpp>
|
||||||
|
#include <boost/fusion/support/is_sequence.hpp>
|
||||||
|
#include <boost/fusion/support/is_view.hpp>
|
||||||
|
#include <boost/fusion/iterator.hpp>
|
||||||
|
|
||||||
|
#include <boost/mpl/assert.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using namespace boost::fusion;
|
||||||
|
typedef std::array<int,3> array_type;
|
||||||
|
|
||||||
|
BOOST_MPL_ASSERT((traits::is_sequence<array_type>));
|
||||||
|
BOOST_MPL_ASSERT_NOT((traits::is_view<array_type>));
|
||||||
|
|
||||||
|
array_type arr = {{1,2,3}};
|
||||||
|
|
||||||
|
BOOST_TEST(*boost::fusion::begin(arr) == 1);
|
||||||
|
BOOST_TEST(*boost::fusion::next(boost::fusion::begin(arr)) == 2);
|
||||||
|
BOOST_TEST(*advance_c<2>(boost::fusion::begin(arr)) == 3);
|
||||||
|
BOOST_TEST(prior(boost::fusion::next(boost::fusion::begin(arr))) == boost::fusion::begin(arr));
|
||||||
|
BOOST_TEST(*prior(boost::fusion::end(arr)) == 3);
|
||||||
|
BOOST_TEST(at_c<2>(arr) == 3);
|
||||||
|
BOOST_TEST(boost::fusion::size(arr) == 3);
|
||||||
|
BOOST_TEST(distance(boost::fusion::begin(arr), boost::fusion::end(arr)) == 3);
|
||||||
|
|
||||||
|
return boost::report_errors();
|
||||||
|
}
|
||||||
|
#endif
|
Reference in New Issue
Block a user