#pragma once #include "siterator.hpp" #include namespace extra { using namespace siterator; template())> struct to_bool_arr_helper { typedef I cur_iterator; template struct iteration { typedef to_bool_arr_helper type; }; void operator ()(const T& val, std::array &arr) const { arr[N - I::type::value - 1] = (val & (1 << I::type::value)) != 0; } }; template::value>::type, typename N = std::integral_constant> void to_bool_arr(const T& val, std::array &arr) { do_loop, static_iterator>(val, arr); } template())> struct arr_writer { typedef I cur_iterator; template struct iteration { typedef arr_writer type; }; void operator ()(const std::array &arr) const { std::cout << arr[I::type::value]; } }; template void do_arr_write(const std::array &arr) { do_loop, decltype(uint_iterator())>(arr); } }