1/*
2Copyright 2023 Glen Joseph Fernandes
3(glenjofe@gmail.com)
4
5Distributed 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
13struct range {
14 std::size_t size() const {
15 return 4;
16 }
17};
18
19void test_range()
20{
21 range c;
22 BOOST_TEST_EQ(boost::size(c), 4);
23}
24
25void test_array()
26{
27 int a[4];
28 BOOST_TEST_EQ(boost::size(a), 4);
29}
30
31int main()
32{
33 test_range();
34 test_array();
35 return boost::report_errors();
36}
37#else
38int main()
39{
40 return 0;
41}
42#endif
43

source code of boost/libs/core/test/size_test.cpp