lockstep.cpp 514 B

1234567891011121314151617181920
  1. // Copyright Louis Dionne 2013-2017
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  4. #include <boost/hana/functional/lockstep.hpp>
  5. #include <boost/hana/plus.hpp>
  6. namespace hana = boost::hana;
  7. constexpr int to_int(char c) {
  8. return static_cast<int>(c) - 48;
  9. }
  10. constexpr int increment(int i) {
  11. return i + 1;
  12. }
  13. static_assert(hana::lockstep(hana::plus)(to_int, increment)('3', 4) == 3 + 5, "");
  14. int main() { }