]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/test/include/boost/test/data/monomorphic/array.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / test / include / boost / test / data / monomorphic / array.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 type arrays
10// ***************************************************************************
11
12#ifndef BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
13#define BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
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 array {
35public:
36 typedef T sample;
37
38 enum { arity = 1 };
39
40 typedef T const* iterator;
41
42 // Constructor
43 array( T const* arr_, std::size_t size_ )
44 : m_arr( arr_ )
45 , m_size( size_ )
46 {}
47
48 // dataset interface
49 data::size_t size() const { return m_size; }
50 iterator begin() const { return m_arr; }
51
52private:
53 // Data members
54 T const* m_arr;
55 std::size_t m_size;
56};
57
58//____________________________________________________________________________//
59
60//! An array dataset is a dataset
61template<typename T>
62struct is_dataset<array<T>> : mpl::true_ {};
63
64} // namespace monomorphic
65
66//____________________________________________________________________________//
67
68//! @overload boost::unit_test::data::make()
69template<typename T, std::size_t size>
70inline monomorphic::array<typename boost::remove_const<T>::type>
71make( T (&a)[size] )
72{
73 return monomorphic::array<typename boost::remove_const<T>::type>( a, size );
74}
75
76} // namespace data
77} // namespace unit_test
78} // namespace boost
79
80#include <boost/test/detail/enable_warnings.hpp>
81
82#endif // BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
83