Boost.Hana
1.0.1
Your standard library for metaprogramming
Отметьте реализацию метода, распределенного по тегу, как реализацию по умолчанию.
При определении новой концепции с помощью методов, распределенных по тегам, иногда можно обеспечить реализацию по умолчанию для некоторых методов. делатьдефолт
базовый класс такой реализации по умолчанию позволяет определить, был ли метод впоследствии отправлен в реализацию по умолчанию.
Example
#include <algorithm>
#include <iterator>
#include <sstream>
#include <vector>
template <typename T>
struct print_impl : hana::default_ {
template <typename Stream, typename X>
static void apply (Stream& out, X
const & x)
{ out << x; }
};
auto print = [](
auto & stream,
auto const & x) {
return print_impl<hana::tag_of_t<decltype(x)>>
::apply (stream, x);
};
template <typename T>
struct print_impl<
std ::vector<T>> {
template <typename Stream>
static void apply (Stream& out, std::vector<T>
const & xs) {
out << '[' ;
std::copy(begin(xs), end(xs), std::ostream_iterator<T>{out, ", " });
out << ']' ;
}
};
static_assert(hana::is_default<print_impl<int>>{}, "" );
static_assert(!hana::is_default<print_impl<std::vector<int>>>{}, "" );
int main() {
{
std::stringstream s;
print (s, std::vector<int>{1, 2, 3});
}
{
std::stringstream s;
}
}
Унаследовано с помощью boost::hana::accessors_impl< S, when< condition >>, boost::hana::adjust_if_impl< Веселье, когда< состояние >>, повышение::hana::adjust_impl< Веселье, когда< состояние >>, повышение::hana::all_impl< S, when< condition >>; boost::hana::all_of_impl< S, when< condition >>, boost::hana:::: и_impl< L, when< condition >>; boost::hana::any_impl< S, when< condition >>; boost::hana::any_of_impl< S, when< condition >>, boost::hana::ap_impl< A, when< condition >>, boost::hana::append_impl< M, when< condition >>, boost::hana::at_impl< Это когда< состояние >>, boost::hana::at_key_impl< S, when< condition >>, boost::hana::back_impl< Это когда< состояние >>, boost::hana::cartesian_product_impl< S, when< condition >>, boost::hana::chain_impl< M, when< condition >>, boost::hana::concat_impl< M, when< condition >>, boost::hana::contains_impl< S, when< condition >>, boost::hana::count_if_impl< T, when< condition >>, boost::hana::count_impl< T, when< condition >>, boost::hana::cycle_impl< M, when< condition >>, boost::hana::difference_impl< S, when< condition >>, boost::hana::div_impl< T, U, when< condition >>, boost::hana::drop_back_impl< S, when< condition >>, boost::hana::drop_front_exactly_impl< Это когда< состояние >>, boost::hana::drop_front_impl< Это когда< состояние >>, boost::hana::drop_while_impl< Это когда< состояние >>, boost::hana::duplicate_impl< W, when< condition >>, boost::hana::empty_impl< M, when< condition >>, boost::hana::equal_impl< T, U; when< condition >>, boost::hana::erase_key_impl< T, when< condition >>, boost::hana::eval_if_impl< L, when< condition >>, boost::hana::eval_impl< T, when< condition >>, boost::hana::extend_impl< W, when< condition >>; boost::hana::extract_impl< W, when< condition >>; boost::hana::fill_impl< Fun, when< condition >>, boost::hana::filter_impl< M; when< condition >>, boost::hana::find_if_impl< S, when< condition >>, boost::hana::find_impl< S, when< condition >>, boost::hana::first_impl< P, when< condition >>, boost::hana::flatten_impl< M, when< condition >>, boost::hana::fold_left_impl< T, when< condition >>, boost::hana::fold_right_impl< T, when< condition >>, boost::hana::for_each_impl< T, when< condition >>, boost::hana::front_impl< Это, когда< состояние >>, повышение::hana:: greater_equal_impl< T, U, когда< состояние >>, повышение::hana:: greater_impl< T, U, когда< состояние >>, повышение::hana::group_impl< S, when< condition >>, boost::hana::hash_impl< Tag< condition >>, boost::hana::if_impl< L, when< condition >>; boost::hana::insert_impl< T, when< condition >>, boost::hana::intersection_impl< S, when< condition >>, boost::hana::intersperse_impl< S, when< condition >>, boost::hana::is_disjoint_impl< S1, S2; when< condition >>, boost::hana::is_empty_impl< It, when< condition >>, boost::hana::is_subset_impl< S1, S2, when< condition >>, boost::hana::keys_impl< T, when< condition >>, boost::hana::length_impl< T, when< condition >>, boost::hana::less_equal_impl< T, U, when< condition >>, boost::hana::lexicographical_compare_impl< Это когда< состояние >>, boost::hana::lift_impl< A, when< condition >>, boost::hana::make_impl< Datatype, when< condition >>, boost::hana::max_impl< T, U, when< condition >>, boost::hana::maximum_impl< T, when< condition >>, boost::hana::maximum_pred_impl< T, when< condition >>, boost::hana::members_impl< S, when< condition >>, boost::hana::min_impl< T, U, when< condition >>, boost::hana::minimum_impl< T, when< condition >>, boost::hana::minimum_pred_impl< T, when< condition >>, boost::hana::minus_impl< T, T, when< condition >>, boost::hana::minus_impl< T, U, when>, boost::hana::monadic_fold_left_impl< T, when< condition >>, boost::hana::monadic_fold_right_impl< T, when< condition >>, boost::hana::mult_impl< T, U, when< condition >>, boost::hana::negate_impl< T, when< condition >>, boost::hana::none_impl< S, when< condition >>, boost::hana::none_of_impl< S, when< condition >>, boost::hana::not_equal_impl< T, U, when< condition >>, boost::hana::not_impl< L, when< condition >>; boost::hana::one_impl< R, when< condition >>, boost::hana::or_impl< L, when< condition >>, boost::hana::partition_impl< S, when< condition >>, boost::hana::permutations_impl< S, when< condition >>, boost::hana::plus_impl< T, U, when< condition >>, boost::hana::power_impl< R, when< condition >>, boost::hana::prefix_impl< M, when< condition >>, boost::hana::prepend_impl< M, when< condition >>, boost::hana::product_impl< T, when< condition >>, boost::hana::remove_at_impl< S, when< condition >>, boost::hana::remove_if_impl< M, when< condition >>, boost::hana::remove_impl< S, when< condition >>, boost::hana::repeat_impl< I, when< condition >>, boost::hana::replace_if_impl< Веселье, когда< состояние >>, повышение::hana::replace_impl< Fun, when< condition >>, boost::hana::replicate_impl< M, when< condition >>, boost::hana::reverse_impl< S, when< condition >>, boost::hana::scan_left_impl< S, when< condition >>, boost::hana::scan_right_impl< S, when< condition >>, boost::hana::second_impl< P, when< condition >>, boost::hana::slice_impl< S, when< condition >>, boost::hana::sort_impl< S, when< condition >>, boost::hana::span_impl< S, when< condition >>, boost::hana::suffix_impl< M, when< condition >>, boost::hana::sum_impl< T, when< condition >>, boost::hana::symmetric_difference_impl< S, when< condition >>; boost::hana::take_back_impl< S, when< condition >>, boost::hana::take_front_impl< S, when< condition >>; boost::hana::take_while_impl< S, when< condition >>, boost::hana::tap_impl< M, when< condition >>, boost::hana::then_impl< M, when< condition >>, boost::hana::transform_impl< Веселье, когда< состояние >>, повышение::hana::unfold_left_impl< S, when< condition >>, boost::hana::unfold_right_impl< S, when< condition >>, boost::hana::union_impl< S, when< condition >>, boost::hana::unique_impl< S, when< condition >>, boost::hana::unpack_impl< T, when< condition >>, boost::hana::value_impl< C, when< condition >>, boost::hana::while_impl< L, hana:: when< condition >>, boost::hana::zero_impl< M; when< condition >>, boost::hana::zip_impl< S, when< condition >>, boost::hana::zip_shortest_impl< S, when< condition >>and boost::hana::zip_shortest_with_impl< S, when< condition >>
Статья Boost.Hana: boost::hana::default_ Struct Reference раздела может быть полезна для разработчиков на c++ и boost.
Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.
:: Главная :: ::