fusion/test/sequence/deque_nest.cpp
Lee Clagett 5906d9c316 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.
2016-08-26 12:45:11 -04:00

44 lines
1.4 KiB
C++

/*=============================================================================
Copyright (C) 2015 Kohei Takahshi
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/fusion/container/deque/deque.hpp>
#include <boost/core/lightweight_test.hpp>
#define FUSION_SEQUENCE boost::fusion::deque
#include "nest.hpp"
/* deque has a few issues:
- sequence conversion constructor is explicit
- assignment sequence conversion has bug in base class
- c++11 direct assignment from lvalue has bug */
template <typename T>
struct skip_issues
{
template <typename Source, typename Expected>
bool operator()(Source const& source, Expected const& expected) const
{
using namespace test_detail;
return
#if defined(BOOST_FUSION_HAS_VARIADIC_DEQUE)
run< can_construct<T> >(source, expected) &&
run< can_implicit_construct<T> >(source, expected) &&
run< can_rvalue_assign<T> >(source, expected) &&
run< can_convert_using<can_construct>::to<T> >(source, expected) &&
#else
run< can_copy<T> >(source, expected) &&
#endif
run< can_construct_from_elements<T> >(source, expected);
}
};
int
main()
{
test<skip_issues>();
return boost::report_errors();
}