The ctor should check which is seqence or not.

This commit is contained in:
Kohei Takahashi
2015-01-11 01:15:52 +09:00
parent 54dedc5e98
commit f872d1326a
10 changed files with 34 additions and 9 deletions

View File

@ -25,8 +25,11 @@
#include <boost/type_traits/is_convertible.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/not.hpp>
namespace boost { namespace fusion
{
@ -73,8 +76,10 @@ namespace boost { namespace fusion
BOOST_FUSION_GPU_ENABLED
cons(
Sequence const& seq
, typename boost::disable_if<
is_convertible<Sequence, Car> // use copy to car instead
, typename boost::enable_if<
mpl::and_<
traits::is_sequence<Sequence>
, mpl::not_<is_convertible<Sequence, Car> > > // use copy to car instead
>::type* /*dummy*/ = 0
)
: car(*fusion::begin(seq))
@ -105,7 +110,11 @@ namespace boost { namespace fusion
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
typename boost::disable_if<is_convertible<Sequence, Car>, cons&>::type
typename boost::enable_if<
mpl::and_<
traits::is_sequence<Sequence>
, mpl::not_<is_convertible<Sequence, Car> > >
, cons&>::type
operator=(Sequence const& seq)
{
typedef typename result_of::begin<Sequence const>::type Iterator;

View File

@ -10,6 +10,8 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/list/list_fwd.hpp>
#include <boost/fusion/container/list/detail/list_to_cons.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/core/enable_if.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/container/list/detail/preprocessed/list.hpp>
@ -59,7 +61,8 @@ namespace boost { namespace fusion
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
list(Sequence const& rhs)
list(Sequence const& rhs
, typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0)
: inherited_type(rhs) {}
// Expand a couple of forwarding constructors for arguments
@ -80,10 +83,10 @@ namespace boost { namespace fusion
return *this;
}
template <typename T>
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
list&
operator=(T const& rhs)
typename boost::enable_if<traits::is_sequence<Sequence>, list&>::type
operator=(Sequence const& rhs)
{
inherited_type::operator=(rhs);
return *this;

View File

@ -8,6 +8,7 @@
#define FUSION_SET_09162005_1104
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/category_of.hpp>
#include <boost/fusion/support/detail/access.hpp>
@ -22,6 +23,7 @@
#include <boost/fusion/container/vector/vector.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/core/enable_if.hpp>
#if !defined(BOOST_FUSION_DONT_USE_PREPROCESSED_FILES)
#include <boost/fusion/container/set/detail/preprocessed/set.hpp>
@ -69,7 +71,8 @@ namespace boost { namespace fusion
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
set(Sequence const& rhs)
set(Sequence const& rhs
, typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0)
: data(rhs) {}
#include <boost/fusion/container/set/detail/set_forward_ctor.hpp>

View File

@ -208,6 +208,7 @@ FUSION_HASH endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(
Sequence const& seq
, typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0
#if (N == 1)
, typename boost::disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0
#endif
@ -218,6 +219,7 @@ FUSION_HASH endif
BOOST_FUSION_GPU_ENABLED
BOOST_PP_CAT(vector, N)(
Sequence& seq
, typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0
#if (N == 1)
, typename boost::disable_if<is_convertible<Sequence, T0> >::type* /*dummy*/ = 0
#endif

View File

@ -11,6 +11,7 @@
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/container/vector/vector_fwd.hpp>
#include <boost/fusion/container/vector/detail/vector_n_chooser.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
@ -20,6 +21,7 @@
#include <boost/type_traits/add_const.hpp>
#include <boost/type_traits/is_base_of.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/core/enable_if.hpp>
#define FUSION_HASH #
@ -115,7 +117,8 @@ namespace boost { namespace fusion
template <typename Sequence>
BOOST_FUSION_GPU_ENABLED
vector(Sequence const& rhs)
vector(Sequence const& rhs,
typename boost::enable_if<traits::is_sequence<Sequence> >::type* = 0)
: vec(BOOST_FUSION_VECTOR_COPY_INIT()) {}
// Expand a couple of forwarding constructors for arguments

View File

@ -10,6 +10,7 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/vector10_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>

View File

@ -11,6 +11,7 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/vector20_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>

View File

@ -10,6 +10,7 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/vector30_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>

View File

@ -11,6 +11,7 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/vector40_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>

View File

@ -10,6 +10,7 @@
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/vector/vector50_fwd.hpp>
#include <boost/fusion/support/sequence_base.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/support/detail/access.hpp>
#include <boost/fusion/iterator/next.hpp>
#include <boost/fusion/iterator/deref.hpp>