varray_concept.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // 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. #ifndef BOOST_CONTAINER_VARRAY_CONCEPT_HPP
  10. #define BOOST_CONTAINER_VARRAY_CONCEPT_HPP
  11. #include <boost/concept_check.hpp>
  12. namespace boost { namespace container { namespace dtl { namespace concept {
  13. /**
  14. * VArrayStrategyConcept
  15. *
  16. * \brief Checks strategy for varray<Value,Capacity,Strategy>, which has similarities to std::allocator
  17. * \ingroup varray
  18. */
  19. template<typename Strategy>
  20. struct VArrayStrategy {
  21. #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
  22. // typedefs are the same as in std::allocator
  23. typedef typename Strategy::value_type value_type;
  24. typedef typename Strategy::size_type size_type;
  25. typedef typename Strategy::difference_type difference_type;
  26. typedef typename Strategy::pointer pointer;
  27. typedef typename Strategy::const_pointer const_pointer;
  28. typedef typename Strategy::reference reference;
  29. typedef typename Strategy::const_reference const_reference;
  30. struct check_methods
  31. {
  32. static void apply()
  33. {
  34. Strategy const* str = 0;
  35. // must implement allocate_failed
  36. str->allocate_failed();
  37. boost::ignore_unused_variable_warning(str);
  38. }
  39. };
  40. public :
  41. BOOST_CONCEPT_USAGE(VArrayStrategy)
  42. {
  43. check_methods::apply();
  44. }
  45. #endif
  46. };
  47. }}}} // namespace boost::container::dtl::concept
  48. #endif //BOOST_CONTAINER_VARRAY_CONCEPT_HPP