forked from boostorg/fusion
Make C++11 fusion::vector more consistent with C++03 fusion::vector
- Construct from elements is enabled iff each argument is_convertible to corresponding element. - Construct from sequence is enabled iff the single argument is a fusion sequence. - C++11 vector and tuple also disable construct from sequence that are shorter than the destination. C++03 gives incorrect is_convertible responses in this situation and fails to compile if that constructor is used; C++11 can have instantation errors in and_<is_convertible<U, T>...> without the additional check. - C++11 tuple and vector support truncation conversion and assignment like all other sequences.
This commit is contained in:
32
test/sequence/vector_traits.cpp
Normal file
32
test/sequence/vector_traits.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*=============================================================================
|
||||
Copyright (C) 2016 Lee Clagett
|
||||
|
||||
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/detail/lightweight_test.hpp>
|
||||
#include <boost/fusion/container/list.hpp>
|
||||
#include <boost/fusion/container/vector.hpp>
|
||||
|
||||
#define FUSION_SEQUENCE boost::fusion::vector
|
||||
#define FUSION_ALT_SEQUENCE boost::fusion::list
|
||||
#include "traits.hpp"
|
||||
|
||||
int main() {
|
||||
test_convertible(true /* has conversion construction */ );
|
||||
|
||||
// C++11 models overly aggressive (bug) implicit conversion from C++03
|
||||
BOOST_TEST((
|
||||
is_convertible<
|
||||
boost::fusion::list<int>
|
||||
, boost::fusion::vector< boost::fusion::list<int> >
|
||||
>(true)
|
||||
));
|
||||
|
||||
#if defined(FUSION_TEST_HAS_CONSTRUCTIBLE)
|
||||
test_constructible();
|
||||
#endif
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user