first_scalar_test.cpp 520 B

1234567891011121314151617181920
  1. /*
  2. Copyright 2019 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License, Version 1.0.
  5. (http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #include <boost/core/first_scalar.hpp>
  8. #include <boost/core/lightweight_test.hpp>
  9. int main()
  10. {
  11. int i1 = 0;
  12. BOOST_TEST_EQ(boost::first_scalar(&i1), &i1);
  13. int i2[4] = { };
  14. BOOST_TEST_EQ(boost::first_scalar(i2), &i2[0]);
  15. int i3[2][4][6] = { };
  16. BOOST_TEST_EQ(boost::first_scalar(i3), &i3[0][0][0]);
  17. return boost::report_errors();
  18. }