Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/test/data/monomorphic/array.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //  (C) Copyright Gennadiy Rozental 2001.
0002 //  Distributed under the Boost Software License, Version 1.0.
0003 //  (See accompanying file LICENSE_1_0.txt or copy at
0004 //  http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 //  See http://www.boost.org/libs/test for the library home page.
0007 //
0008 ///@file
0009 ///Defines monomorphic dataset based on C type arrays
0010 // ***************************************************************************
0011 
0012 #ifndef BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
0013 #define BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
0014 
0015 // Boost.Test
0016 #include <boost/test/data/config.hpp>
0017 #include <boost/test/data/monomorphic/fwd.hpp>
0018 
0019 #include <boost/test/detail/suppress_warnings.hpp>
0020 
0021 //____________________________________________________________________________//
0022 
0023 namespace boost {
0024 namespace unit_test {
0025 namespace data {
0026 namespace monomorphic {
0027 
0028 // ************************************************************************** //
0029 // **************                     array                    ************** //
0030 // ************************************************************************** //
0031 
0032 /// Dataset view of a C array
0033 template<typename T>
0034 class array {
0035 public:
0036     typedef T sample;
0037 
0038     static const int arity = 1;
0039 
0040     typedef T const* iterator;
0041 
0042     // Constructor
0043     array( T const* arr_, std::size_t size_ )
0044     : m_arr( arr_ )
0045     , m_size( size_ )
0046     {}
0047 
0048     // dataset interface
0049     data::size_t    size() const    { return m_size; }
0050     iterator        begin() const   { return m_arr; }
0051 
0052 private:
0053     // Data members
0054     T const*        m_arr;
0055     std::size_t     m_size;
0056 };
0057 
0058 //____________________________________________________________________________//
0059 
0060 //! An array dataset is a dataset
0061 template<typename T>
0062 struct is_dataset<array<T>> : mpl::true_ {};
0063 
0064 } // namespace monomorphic
0065 
0066 //____________________________________________________________________________//
0067 
0068 //! @overload boost::unit_test::data::make()
0069 template<typename T, std::size_t size>
0070 inline monomorphic::array<typename boost::remove_const<T>::type>
0071 make( T (&a)[size] )
0072 {
0073     return monomorphic::array<typename boost::remove_const<T>::type>( a, size );
0074 }
0075 
0076 } // namespace data
0077 } // namespace unit_test
0078 } // namespace boost
0079 
0080 #include <boost/test/detail/enable_warnings.hpp>
0081 
0082 #endif // BOOST_TEST_DATA_MONOMORPHIC_ARRAY_HPP_121411GER
0083