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;