cont_concepts.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Range v3 library
  2. //
  3. // Copyright Eric Niebler 2014-present
  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. #include <array>
  10. #include <vector>
  11. #include <memory>
  12. #include <range/v3/core.hpp>
  13. #include <range/v3/action/concepts.hpp>
  14. #include <range/v3/view/ref.hpp>
  15. #include "../simple_test.hpp"
  16. #include "../test_utils.hpp"
  17. int main()
  18. {
  19. using namespace ranges;
  20. int rgi[6];
  21. CPP_assert(range<decltype(rgi)>);
  22. CPP_assert(!semi_container<decltype(rgi)>);
  23. std::array<int, 6> a;
  24. CPP_assert(semi_container<decltype(a)>);
  25. CPP_assert(!container<decltype(a)>);
  26. std::vector<int> v;
  27. CPP_assert(container<decltype(v)>);
  28. std::vector<std::unique_ptr<int>> v2;
  29. CPP_assert(container<decltype(v2)>);
  30. CPP_assert(lvalue_container_like<decltype((v2))>);
  31. CPP_assert(!lvalue_container_like<decltype(std::move(v2))>);
  32. CPP_assert(lvalue_container_like<decltype(views::ref(v2))>);
  33. return ::test_result();
  34. }