unique_ptr_test_utils_end.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // (C) Copyright Howard Hinnant 2009
  4. // (C) Copyright Ion Gaztanaga 2014-2014.
  5. //
  6. // Distributed under the Boost Software License, Version 1.0.
  7. // (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // See http://www.boost.org/libs/move for documentation.
  11. //
  12. //////////////////////////////////////////////////////////////////////////////
  13. #ifndef BOOST_MOVE_UNIQUE_PTR_TEST_UTILS_END_HPP
  14. #define BOOST_MOVE_UNIQUE_PTR_TEST_UTILS_END_HPP
  15. #ifndef BOOST_MOVE_UNIQUE_PTR_TEST_UTILS_BEG_HPP
  16. #error "unique_ptr_test_utils_beg.hpp MUST be included before this header"
  17. #endif
  18. //Define the incomplete I type and out of line functions
  19. struct I
  20. {
  21. static int count;
  22. I() {++count;}
  23. I(const A&) {++count;}
  24. ~I() {--count;}
  25. };
  26. int I::count = 0;
  27. I* get() {return new I;}
  28. I* get_array(int i) {return new I[i];}
  29. void check(int i)
  30. {
  31. BOOST_TEST(I::count == i);
  32. }
  33. template <class T, class D>
  34. J<T, D>::~J() {}
  35. void reset_counters()
  36. { A::count = 0; B::count = 0; I::count = 0; }
  37. #endif //BOOST_MOVE_UNIQUE_PTR_TEST_UTILS_END_HPP