mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-29 03:57:36 +02:00
adapt plain old array types (2)
[SVN r59577]
This commit is contained in:
38
include/boost/fusion/adapted/array/at_impl.hpp
Normal file
38
include/boost/fusion/adapted/array/at_impl.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_AT_IMPL_HPP
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/remove_extent.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template<typename>
|
||||
struct at_impl;
|
||||
|
||||
template<>
|
||||
struct at_impl<po_array_tag>
|
||||
{
|
||||
template<typename Seq, typename N>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
add_reference<typename remove_extent<Seq>::type>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return seq[N::value];
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
42
include/boost/fusion/adapted/array/begin_impl.hpp
Normal file
42
include/boost/fusion/adapted/array/begin_impl.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_BEGIN_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_BEGIN_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/iterator/basic_iterator.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template<typename>
|
||||
struct begin_impl;
|
||||
|
||||
template <>
|
||||
struct begin_impl<po_array_tag>
|
||||
{
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
basic_iterator<
|
||||
po_array_iterator_tag
|
||||
, random_access_traversal_tag
|
||||
, Seq
|
||||
, 0
|
||||
>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return type(seq,0);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
32
include/boost/fusion/adapted/array/category_of_impl.hpp
Normal file
32
include/boost/fusion/adapted/array/category_of_impl.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_CATEGORY_OF_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_CATEGORY_OF_IMPL_HPP
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct random_access_traversal_tag;
|
||||
|
||||
namespace extension
|
||||
{
|
||||
template<typename>
|
||||
struct category_of_impl;
|
||||
|
||||
template<>
|
||||
struct category_of_impl<po_array_tag>
|
||||
{
|
||||
template<typename Seq>
|
||||
struct apply
|
||||
{
|
||||
typedef random_access_traversal_tag type;
|
||||
};
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
#endif
|
40
include/boost/fusion/adapted/array/deref_impl.hpp
Normal file
40
include/boost/fusion/adapted/array/deref_impl.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_DEREF_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_DEREF_IMPL_HPP
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/remove_extent.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct deref_impl;
|
||||
|
||||
template <>
|
||||
struct deref_impl<po_array_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
{
|
||||
typedef typename
|
||||
add_reference<
|
||||
typename remove_extent<typename It::seq_type>::type
|
||||
>::type
|
||||
type;
|
||||
|
||||
static type
|
||||
call(It const& it)
|
||||
{
|
||||
return (*it.seq)[It::index::value];
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
44
include/boost/fusion/adapted/array/end_impl.hpp
Normal file
44
include/boost/fusion/adapted/array/end_impl.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_END_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_END_IMPL_HPP
|
||||
|
||||
#include <boost/fusion/iterator/basic_iterator.hpp>
|
||||
#include <boost/type_traits/rank.hpp>
|
||||
#include <boost/type_traits/extent.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct end_impl;
|
||||
|
||||
template <>
|
||||
struct end_impl<po_array_tag>
|
||||
{
|
||||
template <typename Seq>
|
||||
struct apply
|
||||
{
|
||||
typedef
|
||||
basic_iterator<
|
||||
po_array_iterator_tag
|
||||
, random_access_traversal_tag
|
||||
, Seq
|
||||
, extent<Seq,rank<Seq>::value-1>::value
|
||||
>
|
||||
type;
|
||||
|
||||
static type
|
||||
call(Seq& seq)
|
||||
{
|
||||
return type(seq,0);
|
||||
}
|
||||
};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
28
include/boost/fusion/adapted/array/is_sequence_impl.hpp
Normal file
28
include/boost/fusion/adapted/array/is_sequence_impl.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_IS_SEQUENCE_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_IS_SEQUENCE_IMPL_HPP
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template<typename>
|
||||
struct is_sequence_impl;
|
||||
|
||||
template<>
|
||||
struct is_sequence_impl<po_array_tag>
|
||||
{
|
||||
template<typename Seq>
|
||||
struct apply
|
||||
: mpl::true_
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
28
include/boost/fusion/adapted/array/is_view_impl.hpp
Normal file
28
include/boost/fusion/adapted/array/is_view_impl.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_IS_VIEW_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_IS_VIEW_IMPL_HPP
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template<typename>
|
||||
struct is_view_impl;
|
||||
|
||||
template<>
|
||||
struct is_view_impl<po_array_tag>
|
||||
{
|
||||
template<typename Seq>
|
||||
struct apply
|
||||
: mpl::false_
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
29
include/boost/fusion/adapted/array/size_impl.hpp
Normal file
29
include/boost/fusion/adapted/array/size_impl.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_SIZE_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_SIZE_IMPL_HPP
|
||||
|
||||
#include <boost/type_traits/rank.hpp>
|
||||
#include <boost/type_traits/extent.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template<typename>
|
||||
struct size_impl;
|
||||
|
||||
template<>
|
||||
struct size_impl<po_array_tag>
|
||||
{
|
||||
template<typename Seq>
|
||||
struct apply
|
||||
: extent<Seq,rank<Seq>::value-1>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
@ -1,58 +1,72 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 Joel de Guzman
|
||||
Copyright (c) 2005-2006 Dan Marsden
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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(FUSION_SEQUENCE_TAG_OF_27122005_1030)
|
||||
#define FUSION_SEQUENCE_TAG_OF_27122005_1030
|
||||
|
||||
#ifndef BOOST_FUSION_ADAPTED_ARRAY_TAG_OF_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_TAG_OF_HPP
|
||||
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename T, std::size_t N>
|
||||
class array;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion
|
||||
namespace boost
|
||||
{
|
||||
struct array_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
namespace traits
|
||||
namespace fusion
|
||||
{
|
||||
template<typename T, std::size_t N>
|
||||
#if defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
|
||||
struct tag_of<boost::array<T,N>, void >
|
||||
#else
|
||||
struct tag_of<boost::array<T,N> >
|
||||
#endif
|
||||
struct po_array_tag;
|
||||
struct po_array_iterator_tag;
|
||||
struct random_access_traversal_tag;
|
||||
struct fusion_sequence_tag;
|
||||
|
||||
namespace traits
|
||||
{
|
||||
typedef array_tag type;
|
||||
#ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
|
||||
template<typename T, std::size_t N>
|
||||
struct tag_of<T[N], void>
|
||||
{
|
||||
typedef po_array_tag type;
|
||||
};
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct tag_of<T const[N], void>
|
||||
{
|
||||
typedef po_array_tag type;
|
||||
};
|
||||
#else
|
||||
template<typename T, std::size_t N>
|
||||
struct tag_of<T[N], void>
|
||||
{
|
||||
typedef po_array_tag type;
|
||||
};
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct tag_of<T const[N], void>
|
||||
{
|
||||
typedef po_array_tag type;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
namespace mpl
|
||||
{
|
||||
template<typename>
|
||||
struct sequence_tag;
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct sequence_tag<T[N]>
|
||||
{
|
||||
typedef fusion::po_array_tag type;
|
||||
};
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct sequence_tag<T const[N] >
|
||||
{
|
||||
typedef fusion::po_array_tag type;
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl
|
||||
{
|
||||
template<typename>
|
||||
struct sequence_tag;
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct sequence_tag<array<T,N> >
|
||||
{
|
||||
typedef fusion::fusion_sequence_tag type;
|
||||
};
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct sequence_tag<array<T,N> const>
|
||||
{
|
||||
typedef fusion::fusion_sequence_tag type;
|
||||
};
|
||||
}}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
28
include/boost/fusion/adapted/array/value_at_impl.hpp
Normal file
28
include/boost/fusion/adapted/array/value_at_impl.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_VALUE_AT_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_VALUE_AT_IMPL_HPP
|
||||
|
||||
#include <boost/type_traits/remove_extent.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template<typename>
|
||||
struct value_at_impl;
|
||||
|
||||
template <>
|
||||
struct value_at_impl<po_array_tag>
|
||||
{
|
||||
template <typename Seq, typename N>
|
||||
struct apply
|
||||
: remove_extent<Seq>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
28
include/boost/fusion/adapted/array/value_of_impl.hpp
Normal file
28
include/boost/fusion/adapted/array/value_of_impl.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2010 Christopher Schmidt
|
||||
|
||||
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_FUSION_ADAPTED_ARRAY_VALUE_OF_IMPL_HPP
|
||||
#define BOOST_FUSION_ADAPTED_ARRAY_VALUE_OF_IMPL_HPP
|
||||
|
||||
#include <boost/type_traits/remove_extent.hpp>
|
||||
|
||||
namespace boost { namespace fusion { namespace extension
|
||||
{
|
||||
template <typename>
|
||||
struct value_of_impl;
|
||||
|
||||
template <>
|
||||
struct value_of_impl<po_array_iterator_tag>
|
||||
{
|
||||
template <typename It>
|
||||
struct apply
|
||||
: remove_extent<typename It::seq_type>
|
||||
{};
|
||||
};
|
||||
}}}
|
||||
|
||||
#endif
|
58
include/boost/fusion/adapted/boost_array/tag_of.hpp
Normal file
58
include/boost/fusion/adapted/boost_array/tag_of.hpp
Normal file
@ -0,0 +1,58 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2001-2006 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(FUSION_SEQUENCE_TAG_OF_27122005_1030)
|
||||
#define FUSION_SEQUENCE_TAG_OF_27122005_1030
|
||||
|
||||
#include <boost/fusion/support/tag_of_fwd.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename T, std::size_t N>
|
||||
class array;
|
||||
}
|
||||
|
||||
namespace boost { namespace fusion
|
||||
{
|
||||
struct 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<boost::array<T,N>, void >
|
||||
#else
|
||||
struct tag_of<boost::array<T,N> >
|
||||
#endif
|
||||
{
|
||||
typedef array_tag type;
|
||||
};
|
||||
}
|
||||
}}
|
||||
|
||||
namespace boost { namespace mpl
|
||||
{
|
||||
template<typename>
|
||||
struct sequence_tag;
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct sequence_tag<array<T,N> >
|
||||
{
|
||||
typedef fusion::fusion_sequence_tag type;
|
||||
};
|
||||
|
||||
template<typename T, std::size_t N>
|
||||
struct sequence_tag<array<T,N> const>
|
||||
{
|
||||
typedef fusion::fusion_sequence_tag type;
|
||||
};
|
||||
}}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user