]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/test/include/boost/test/data/monomorphic/initializer_list.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / test / include / boost / test / data / monomorphic / initializer_list.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///Defines monomorphic dataset based on C++11 initializer_list template
10// ***************************************************************************
11
12#ifndef BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER
13#define BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER
14
15// Boost.Test
16#include <boost/test/data/config.hpp>
17#include <boost/test/data/monomorphic/fwd.hpp>
18
19#include <boost/test/detail/suppress_warnings.hpp>
20
21//____________________________________________________________________________//
22
23namespace boost {
24namespace unit_test {
25namespace data {
26namespace monomorphic {
27
28// ************************************************************************** //
29// ************** array ************** //
30// ************************************************************************** //
31
32/// Dataset view of a C array
33template<typename T>
34class init_list {
35public:
36 typedef T sample;
37
38 enum { arity = 1 };
39
40 typedef T const* iterator;
41
42 //! Constructor swallows initializer_list
43 init_list( std::initializer_list<T>&& il )
44 : m_data( std::forward<std::initializer_list<T>>( il ) )
45 {}
46
47 //! dataset interface
48 data::size_t size() const { return m_data.size(); }
49 iterator begin() const { return m_data.begin(); }
50
51private:
52 // Data members
53 std::initializer_list<T> m_data;
54};
55
56//____________________________________________________________________________//
57
58//! An array dataset is a dataset
59template<typename T>
60struct is_dataset<init_list<T>> : mpl::true_ {};
61
62} // namespace monomorphic
63
64//____________________________________________________________________________//
65
66//! @overload boost::unit_test::data::make()
67template<typename T>
68inline monomorphic::init_list<T>
69make( std::initializer_list<T>&& il )
70{
71 return monomorphic::init_list<T>( std::forward<std::initializer_list<T>>( il ) );
72}
73
74} // namespace data
75} // namespace unit_test
76} // namespace boost
77
78#include <boost/test/detail/enable_warnings.hpp>
79
80#endif // BOOST_TEST_DATA_MONOMORPHIC_INITIALIZATION_LIST_HPP_091515GER
81