#ifndef SPROUT_WEED_DETAIL_BDIGITS_HPP #define SPROUT_WEED_DETAIL_BDIGITS_HPP #include #include #include #include #include #include HDR_ALGORITHM_SSCRISK_CEL_OR_SPROUT_DETAIL #include HDR_ITERATOR_SSCRISK_CEL_OR_SPROUT_DETAIL namespace sprout { namespace weed { namespace detail { template struct bdigits; template<> struct bdigits { public: SPROUT_STATIC_CONSTEXPR sprout::basic_string table = sprout::to_string("01"); }; SPROUT_CONSTEXPR sprout::basic_string sprout::weed::detail::bdigits::table; template<> struct bdigits { public: SPROUT_STATIC_CONSTEXPR sprout::basic_string table = sprout::to_string(L"01"); }; SPROUT_CONSTEXPR sprout::basic_string sprout::weed::detail::bdigits::table; template<> struct bdigits { public: SPROUT_STATIC_CONSTEXPR sprout::basic_string table = sprout::to_string(u"01"); }; SPROUT_CONSTEXPR sprout::basic_string sprout::weed::detail::bdigits::table; template<> struct bdigits { public: SPROUT_STATIC_CONSTEXPR sprout::basic_string table = sprout::to_string(U"01"); }; SPROUT_CONSTEXPR sprout::basic_string sprout::weed::detail::bdigits::table; template struct bvalues; template<> struct bvalues { public: SPROUT_STATIC_CONSTEXPR sprout::array table = sprout::array{ {0, 1} }; }; SPROUT_CONSTEXPR sprout::array sprout::weed::detail::bvalues::table; template SPROUT_CONSTEXPR sprout::tuples::tuple bvalue_at(std::size_t i) { return i < 2 ? sprout::tuples::tuple( static_cast(sprout::weed::detail::bvalues::table[i]), true ) : sprout::tuples::tuple( IntType(), false ) ; } template SPROUT_CONSTEXPR sprout::tuples::tuple from_bdigit(Elem c) { return sprout::weed::detail::bvalue_at( NS_SSCRISK_CEL_OR_SPROUT_DETAIL::distance( sprout::weed::detail::bdigits::table.begin(), NS_SSCRISK_CEL_OR_SPROUT_DETAIL::find( sprout::weed::detail::bdigits::table.begin(), sprout::weed::detail::bdigits::table.end(), c ) ) ); } } // namespace detail } // namespace weed } // namespace sprout #endif // #ifndef SPROUT_WEED_DETAIL_BDIGITS_HPP