storage_order_convert.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2002 The Trustees of Indiana University.
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Boost.MultiArray Library
  6. // Authors: Ronald Garcia
  7. // Jeremy Siek
  8. // Andrew Lumsdaine
  9. // See http://www.boost.org/libs/multi_array for documentation.
  10. //
  11. // test out my new storage_order stuff
  12. //
  13. #include <boost/core/lightweight_test.hpp>
  14. #include <boost/multi_array/storage_order.hpp>
  15. int
  16. main() {
  17. using namespace boost;
  18. array<std::size_t,5> c_ordering = {{4,3,2,1,0}};;
  19. array<std::size_t,5> fortran_ordering = {{0,1,2,3,4}};
  20. array<bool,5> ascending = {{true,true,true,true,true}};
  21. general_storage_order<5> c_storage(c_ordering.begin(),
  22. ascending.begin());
  23. general_storage_order<5> fortran_storage(fortran_ordering.begin(),
  24. ascending.begin());
  25. BOOST_TEST(c_storage == (general_storage_order<5>) c_storage_order());
  26. BOOST_TEST(fortran_storage ==
  27. (general_storage_order<5>) fortran_storage_order());
  28. return boost::report_errors();
  29. }