]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/test/include/boost/test/data/monomorphic/fwd.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / test / include / boost / test / data / monomorphic / fwd.hpp
CommitLineData
7c673cae
FG
1// (C) Copyright Gennadiy Rozental 2001.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6// See http://www.boost.org/libs/test for the library home page.
7//
8/// @file
9/// Forward declares monomorphic datasets interfaces
10// ***************************************************************************
11
12#ifndef BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER
13#define BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER
14
15// Boost.Test
16#include <boost/test/data/config.hpp>
17#include <boost/test/data/size.hpp>
18
19#include <boost/test/utils/is_forward_iterable.hpp>
20
21// Boost
22#include <boost/type_traits/remove_const.hpp>
23#include <boost/type_traits/remove_reference.hpp>
24#include <boost/type_traits/is_array.hpp>
25#include <boost/mpl/bool.hpp>
26
27// STL
28#include <tuple>
29
30#include <boost/test/detail/suppress_warnings.hpp>
31
32// STL
33#include <initializer_list>
34
35//____________________________________________________________________________//
36
37namespace boost {
38namespace unit_test {
39namespace data {
40
41namespace monomorphic {
42
43
44#if !defined(BOOST_TEST_DOXYGEN_DOC__)
45
46template<typename T, typename Specific>
47class dataset;
48
49template<typename T>
50class singleton;
51
52template<typename C>
53class collection;
54
55template<typename T>
56class array;
57
58template<typename T>
59class init_list;
60
61#endif
62
63// ************************************************************************** //
64// ************** monomorphic::is_dataset ************** //
65// ************************************************************************** //
66
67//! Helper metafunction indicating if the specified type is a dataset.
68template<typename DataSet>
69struct is_dataset : mpl::false_ {};
70
71//____________________________________________________________________________//
72
73//! A reference to a dataset is a dataset
74template<typename DataSet>
75struct is_dataset<DataSet&> : is_dataset<DataSet> {};
76
77//____________________________________________________________________________//
78
79//! A const dataset is a dataset
80template<typename DataSet>
81struct is_dataset<DataSet const> : is_dataset<DataSet> {};
82
83} // namespace monomorphic
84
85// ************************************************************************** //
86// ************** data::make ************** //
87// ************************************************************************** //
88
89//! @brief Creates a dataset from a value, a collection or an array
90//!
91//! This function has several overloads:
92//! @code
93//! // returns ds if ds is already a dataset
94//! template <typename DataSet> DataSet make(DataSet&& ds);
95//!
96//! // creates a singleton dataset, for non forward iterable and non dataset type T
97//! // (a C string is not considered as a sequence).
98//! template <typename T> monomorphic::singleton<T> make(T&& v);
99//! monomorphic::singleton<char*> make( char* str );
100//! monomorphic::singleton<char const*> make( char const* str );
101//!
102//! // creates a collection dataset, for forward iterable and non dataset type C
103//! template <typename C> monomorphic::collection<C> make(C && c);
104//!
105//! // creates an array dataset
106//! template<typename T, std::size_t size> monomorphic::array<T> make( T (&a)[size] );
107//! @endcode
108template<typename DataSet>
109inline typename std::enable_if<monomorphic::is_dataset<DataSet>::value,DataSet>::type
110make(DataSet&& ds)
111{
112 return std::forward<DataSet>( ds );
113}
114
115//____________________________________________________________________________//
116
117// warning: doxygen is apparently unable to handle @overload from different files, so if the overloads
118// below are not declared with @overload in THIS file, they do not appear in the documentation.
119
120//! @overload boost::unit_test::data::make()
121template<typename T>
122inline typename std::enable_if<!is_forward_iterable<T>::value &&
123 !monomorphic::is_dataset<T>::value &&
124 !is_array<typename remove_reference<T>::type>::value,
125 monomorphic::singleton<T>>::type
126make( T&& v );
127
128//____________________________________________________________________________//
129
130//! @overload boost::unit_test::data::make()
131template<typename C>
132inline typename std::enable_if<is_forward_iterable<C>::value,monomorphic::collection<C>>::type
133make( C&& c );
134
135//____________________________________________________________________________//
136
137//! @overload boost::unit_test::data::make()
138template<typename T, std::size_t size>
139inline monomorphic::array< typename boost::remove_const<T>::type >
140make( T (&a)[size] );
141
142//____________________________________________________________________________//
143
144//! @overload boost::unit_test::data::make()
145inline monomorphic::singleton<char*>
146make( char* str );
147
148//____________________________________________________________________________//
149
150//! @overload boost::unit_test::data::make()
151inline monomorphic::singleton<char const*>
152make( char const* str );
153
154//____________________________________________________________________________//
155
156//! @overload boost::unit_test::data::make()
157template<typename T>
158inline monomorphic::init_list<T>
159make( std::initializer_list<T>&& );
160
161//____________________________________________________________________________//
162
163namespace result_of {
164
165//! Result of the make call.
166template<typename DataSet>
167struct make {
168 typedef decltype( data::make( declval<DataSet>() ) ) type;
169};
170
171} // namespace result_of
172
173} // namespace data
174} // namespace unit_test
175} // namespace boost
176
177#include <boost/test/detail/enable_warnings.hpp>
178
179#endif // BOOST_TEST_DATA_MONOMORPHIC_FWD_HPP_102212GER
180