| 1 | /* |
|---|---|
| 2 | Copyright 2023 Glen Joseph Fernandes |
| 3 | (glenjofe@gmail.com) |
| 4 | |
| 5 | Distributed under the Boost Software License, Version 1.0. |
| 6 | (http://www.boost.org/LICENSE_1_0.txt) |
| 7 | */ |
| 8 | #include <boost/config.hpp> |
| 9 | #if !defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) |
| 10 | #include <boost/core/size.hpp> |
| 11 | #include <boost/core/lightweight_test.hpp> |
| 12 | |
| 13 | struct range { |
| 14 | std::size_t size() const { |
| 15 | return 4; |
| 16 | } |
| 17 | }; |
| 18 | |
| 19 | void test_range() |
| 20 | { |
| 21 | range c; |
| 22 | BOOST_TEST_EQ(boost::size(c), 4); |
| 23 | } |
| 24 | |
| 25 | void test_array() |
| 26 | { |
| 27 | int a[4]; |
| 28 | BOOST_TEST_EQ(boost::size(a), 4); |
| 29 | } |
| 30 | |
| 31 | int main() |
| 32 | { |
| 33 | test_range(); |
| 34 | test_array(); |
| 35 | return boost::report_errors(); |
| 36 | } |
| 37 | #else |
| 38 | int main() |
| 39 | { |
| 40 | return 0; |
| 41 | } |
| 42 | #endif |
| 43 |
