/*============================================================================= Copyright (c) 2011-2017 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #include #include #include #include #include #include #include #include #include #include #include #include #include static constexpr std::size_t default_limit = 96; static constexpr std::size_t len = std::extent::type>::value - 1; typedef sprout::string string_type; template struct zundoko_result : public sprout::algorithm::results::join > {}; template using zundoko_result_t = typename zundoko_result::type; inline constexpr string_type zundoko(bool c) { return !c ? sprout::to_string("ズン") : sprout::to_string("ドコ") ; } template< std::size_t N, typename Rnd, typename... Args, typename sprout::enabler_if::type = sprout::enabler > inline constexpr typename zundoko_result::type kiyoshi(Rnd const&, bool, bool, bool, bool, Args...) { return throw std::runtime_error("exceeded"), sprout::any_convertible(); } template< std::size_t N, typename Rnd, typename... Args, typename sprout::enabler_if<(sizeof...(Args) + 6 <= N)>::type = sprout::enabler > inline constexpr typename zundoko_result::type kiyoshi(Rnd const& rnd, bool e0, bool e1, bool e2, bool e3, Args... args) { return !sprout::generated_value(rnd) || e0 || e1 || e2 || e3 ? kiyoshi(sprout::next_generator(rnd)(), sprout::generated_value(rnd), e0, e1, e2, e3, args...) : sprout::algorithm::join( sprout::array{{ sprout::to_string("キ・ヨ・シ!"), zundoko(sprout::generated_value(rnd)), zundoko(e0), zundoko(e1), zundoko(e2), zundoko(e3), zundoko(args)... }} | sprout::adaptors::reversed ) ; } template< std::size_t N, typename Rnd, typename... Args, typename sprout::enabler_if<(sizeof...(Args) + 1 <= 4)>::type = sprout::enabler > inline constexpr typename zundoko_result::type kiyoshi(Rnd const& rnd, Args... args) { return kiyoshi(sprout::next_generator(rnd)(), sprout::generated_value(rnd), args...); } template< std::size_t N = default_limit, typename URNG, typename sprout::enabler_if::value>::type = sprout::enabler > inline constexpr typename zundoko_result::type zundoko_kiyoshi(URNG const& urng) { return kiyoshi(sprout::bernoulli_distribution<>()(urng)); } template inline constexpr typename zundoko_result::type zundoko_kiyoshi(std::size_t seed) { return zundoko_kiyoshi(sprout::default_random_engine(seed)); } template inline constexpr typename zundoko_result::type zundoko_kiyoshi() { return zundoko_kiyoshi(SPROUT_UNIQUE_SEED); } #include int main() { constexpr auto result = zundoko_kiyoshi(); std::cout << result; }