box.cpp 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Range v3 library
  2. //
  3. // Copyright Andrey Diduh 2019
  4. //
  5. // Use, modification and distribution is subject to the
  6. // Boost Software License, Version 1.0. (See accompanying
  7. // file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // Project home: https://github.com/ericniebler/range-v3
  11. #include <range/v3/utility/compressed_pair.hpp>
  12. #include "../simple_test.hpp"
  13. using namespace ranges;
  14. // #https://github.com/ericniebler/range-v3/issues/1093
  15. void test_1093()
  16. {
  17. struct Op {};
  18. struct Op2 {};
  19. struct payload { void* v; };
  20. struct base_adaptor {};
  21. struct RANGES_EMPTY_BASES A : base_adaptor, private box<Op, A> {};
  22. struct RANGES_EMPTY_BASES B : base_adaptor, private box<Op2, B> {};
  23. using P = compressed_pair<A, payload>;
  24. using P2 = compressed_pair<B, P>;
  25. CHECK(sizeof(P) == sizeof(payload));
  26. CHECK(sizeof(P2) == sizeof(P));
  27. }
  28. int main()
  29. {
  30. test_1093();
  31. return ::test_result();
  32. }