blob: 94d19bd79343b8d9326e7317ce211bdb35a21404 [file] [log] [blame]
Brian Silvermanfad8f552018-08-04 23:36:19 -07001// Boost.Container varray
2//
3// Copyright (c) 2012-2013 Andrew Hundt.
4// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
5//
6// Use, modification and distribution is subject to the Boost Software License,
7// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
10#ifndef BOOST_CONTAINER_VARRAY_CONCEPT_HPP
11#define BOOST_CONTAINER_VARRAY_CONCEPT_HPP
12
13#include <boost/concept_check.hpp>
14
15namespace boost { namespace container { namespace dtl { namespace concept {
16
17/**
18 * VArrayStrategyConcept
19 *
20 * \brief Checks strategy for varray<Value,Capacity,Strategy>, which has similarities to std::allocator
21 * \ingroup varray
22 */
23template<typename Strategy>
24struct VArrayStrategy {
25#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
26
27 // typedefs are the same as in std::allocator
28 typedef typename Strategy::value_type value_type;
29 typedef typename Strategy::size_type size_type;
30 typedef typename Strategy::difference_type difference_type;
31 typedef typename Strategy::pointer pointer;
32 typedef typename Strategy::const_pointer const_pointer;
33 typedef typename Strategy::reference reference;
34 typedef typename Strategy::const_reference const_reference;
35
36 struct check_methods
37 {
38 static void apply()
39 {
40 Strategy const* str = 0;
41
42 // must implement allocate_failed
43 str->allocate_failed();
44
45 boost::ignore_unused_variable_warning(str);
46 }
47 };
48
49public :
50 BOOST_CONCEPT_USAGE(VArrayStrategy)
51 {
52 check_methods::apply();
53 }
54
55#endif
56};
57
58}}}} // namespace boost::container::dtl::concept
59
60#endif //BOOST_CONTAINER_VARRAY_CONCEPT_HPP