explicit_inst_flat_map_test.cpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost
  4. // Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/container for documentation.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. #include <boost/container/flat_map.hpp>
  11. #include <boost/container/allocator.hpp>
  12. #include "movable_int.hpp"
  13. #include "dummy_test_allocator.hpp"
  14. #include <boost/container/stable_vector.hpp>
  15. #include <boost/container/small_vector.hpp>
  16. #include <boost/container/deque.hpp>
  17. #include <boost/container/static_vector.hpp>
  18. struct empty
  19. {
  20. friend bool operator == (const empty &, const empty &){ return true; }
  21. friend bool operator < (const empty &, const empty &){ return true; }
  22. };
  23. template class ::boost::container::flat_map<empty, empty>;
  24. template class ::boost::container::flat_multimap<empty, empty>;
  25. volatile ::boost::container::flat_map<empty, empty> dummy;
  26. volatile ::boost::container::flat_multimap<empty, empty> dummy2;
  27. namespace boost {
  28. namespace container {
  29. //Explicit instantiation to detect compilation errors
  30. //flat_map
  31. typedef std::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> test_pair_t;
  32. template class flat_map
  33. < test::movable_and_copyable_int
  34. , test::movable_and_copyable_int
  35. , std::less<test::movable_and_copyable_int>
  36. , small_vector< test_pair_t, 10, std::allocator< test_pair_t > >
  37. >;
  38. //flat_multimap
  39. template class flat_multimap
  40. < test::movable_and_copyable_int
  41. , test::movable_and_copyable_int
  42. , std::less<test::movable_and_copyable_int>
  43. , stable_vector< test_pair_t, allocator< test_pair_t > >
  44. >;
  45. template class flat_multimap
  46. < test::movable_and_copyable_int
  47. , test::movable_and_copyable_int
  48. , std::less<test::movable_and_copyable_int>
  49. , deque<test_pair_t, test::simple_allocator< test_pair_t > >
  50. >;
  51. template class flat_multimap
  52. < test::movable_and_copyable_int
  53. , test::movable_and_copyable_int
  54. , std::less<test::movable_and_copyable_int>
  55. , static_vector<test_pair_t, 10 >
  56. >;
  57. //As flat container iterators are typedefs for vector::[const_]iterator,
  58. //no need to explicit instantiate them
  59. }} //boost::container
  60. #if (__cplusplus > 201103L)
  61. #include <vector>
  62. namespace boost{
  63. namespace container{
  64. template class flat_map
  65. < test::movable_and_copyable_int
  66. , test::movable_and_copyable_int
  67. , std::less<test::movable_and_copyable_int>
  68. , std::vector<test_pair_t>
  69. >;
  70. }} //boost::container
  71. #endif
  72. int main()
  73. {
  74. return 0;
  75. }