/usr/include/boost/test/data/monomorphic
Edit: /usr/include/boost/test/data/monomorphic/sample_merge.hpp (3233B)
// (C) Copyright Gennadiy Rozental 2001.
// 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)
// See http://www.boost.org/libs/test for the library home page.
//
/// @file
/// Defines helper routines and types for merging monomorphic samples
// ***************************************************************************
#ifndef BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP
#define BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP
// Boost.Test
#include
#include
#include
#include
namespace boost {
namespace unit_test {
namespace data {
namespace monomorphic {
//____________________________________________________________________________//
namespace ds_detail {
template
struct is_tuple : std::false_type {};
template
struct is_tuple> : std::true_type {};
template
struct is_tuple : is_tuple::type> {};
template
struct is_tuple : is_tuple::type> {};
template
inline auto as_tuple_impl_xvalues( T const & arg, std::false_type /* is_rvalue_ref */ )
-> decltype(std::tuple(arg)) {
//return std::tuple(arg);
return std::forward_as_tuple(arg);
}
template
inline auto as_tuple_impl_xvalues( T && arg, std::true_type /* is_rvalue_ref */ )
-> decltype(std::make_tuple(std::forward(arg))) {
return std::make_tuple(std::forward(arg));
}
template
inline auto as_tuple_impl( T && arg, std::false_type /* is_tuple = nullptr */ )
-> decltype(as_tuple_impl_xvalues(std::forward(arg),
typename std::is_rvalue_reference::type())) {
return as_tuple_impl_xvalues(std::forward(arg),
typename std::is_rvalue_reference::type());
}
//____________________________________________________________________________//
template
inline T &&
as_tuple_impl(T && arg, std::true_type /* is_tuple */ ) {
return std::forward(arg);
}
template
inline auto as_tuple( T && arg )
-> decltype( as_tuple_impl(std::forward(arg),
typename ds_detail::is_tuple::type()) ) {
return as_tuple_impl(std::forward(arg),
typename ds_detail::is_tuple::type());
}
//____________________________________________________________________________//
} // namespace ds_detail
template
inline auto
sample_merge( T1 && a1, T2 && a2 )
-> decltype( std::tuple_cat(ds_detail::as_tuple(std::forward(a1)),
ds_detail::as_tuple(std::forward(a2)) ) ) {
return std::tuple_cat(ds_detail::as_tuple(std::forward(a1)),
ds_detail::as_tuple(std::forward(a2)));
}
} // namespace monomorphic
} // namespace data
} // namespace unit_test
} // namespace boost
#include
#endif // BOOST_TEST_DATA_MONOMORPHIC_SAMPLE_MERGE_HPP