compile.mpl.vector.erb.cpp 691 B

123456789101112131415161718192021222324252627
  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/mpl/find_if.hpp>
  5. #include <boost/mpl/integral_c.hpp>
  6. #include <boost/mpl/push_back.hpp>
  7. #include <boost/mpl/quote.hpp>
  8. #include <boost/mpl/vector.hpp>
  9. namespace mpl = boost::mpl;
  10. struct is_last {
  11. template <typename N>
  12. struct apply
  13. : mpl::integral_c<bool, N::type::value == <%= input_size %>>
  14. { };
  15. };
  16. using vector = <%= mpl_vector((1..input_size).to_a.map { |n|
  17. "mpl::integral_c<int, #{n}>"
  18. }) %>;
  19. using result = mpl::find_if<vector, is_last>::type;
  20. int main() { }