8 ((Base)), incrementable, Base, (),
9 (
ANY_OP(anyxx::self &, ++, (), ),
10 ANY_FN_DEF(
public, anyxx::self, post_inc, (), , ([&x]() {
return x++; }))),
11 , , (
template <
typename Self>
auto operator++(
this Self &&self,
int) {
12 return std::forward<Self>(self).post_inc();
32 ((ValueType), (Reference)), forward_iterator,
33 (ANY_OP(anyxx::self &, ++, (), ),
34 ANY_FN_DEF(public, anyxx::self, post_inc, (), , ([&x]() {
return x++; })),
35 ANY_OP(Reference, *, (),
const),
36 ANY_OP_DEF(
public,
bool, ==, equal_to, (anyxx::self
const &),
const,
37 ([&x](
auto const &r) {
return x == r; })),
38 ANY_OP_DEF(
public,
bool, !=, not_equal_to, (anyxx::self
const &),
const,
39 ([&x](
auto const &r) {
return x != r; }))),
41 (
using iterator_category = std::forward_iterator_tag;
42 using difference_type = std::ptrdiff_t;
using value_type = ValueType;
43 using reference = Reference;
44 template <
typename Self>
auto operator++(
this Self &&self,
int) {
45 return std::forward<Self>(self).post_inc();
49 ((ValueType), (Reference)), forward_range,
50 (
ANY_FN((any_forward_iterator<ValueType, Reference>), begin, (),
const),
51 ANY_FN((any_forward_iterator<ValueType, Reference>), end, (),
const)))
53template <typename ValueType, typename Reference, typename Box = anyxx::
cref>
54using any_forward_range =
any<Box, forward_range<ValueType, Reference>>;
57concept is_any_self_forward_range =
58 is_any<A> && std::ranges::forward_range<A> &&
59 std::same_as<std::ranges::range_value_t<A>, self>;
62template <typename AnyForwardRange>
63 requires is_any_self_forward_range<AnyForwardRange>
64struct translate_sig_model_map<AnyForwardRange const &>
65 : translate_sig_default_model_map<self> {
66 template <
typename AnyValue>
68 any_forward_range<AnyValue, AnyValue,
69 typename AnyForwardRange::proxy_t>
const &;
70 template <
typename Model>
71 using concept_arg = anyxx::any_forward_range<Model, Model, anyxx::cref>;
74template <
typename Concrete,
typename AnyForwardRange>
75 requires is_any_self_forward_range<AnyForwardRange>
76struct v_table_to_map<Concrete, AnyForwardRange const &> {
77 static auto forward(
auto const &any_range) {
78 return std::views::transform(any_range, [](
auto const &
any) {
79 return *unerase_cast<Concrete>(
any);
84template <
typename Traited,
typename AnyForwardRange>
85 requires is_any_self_forward_range<AnyForwardRange>
86struct forward_trait_to_map<Traited, AnyForwardRange const &> {
87 static auto forward(
auto any_range) {
88 return std::views::transform(any_range,
89 []<
typename T>(T
const &
any) -> Traited {
90 if constexpr (is_any<T>) {
91 if constexpr (T::dyn) {
92 return *unerase_cast<Traited>(
any);
94 return get_proxy_value(
any);
C++ header only library for external polymorphism.
The core class template to control dispatch for external polymorphism.
Definition anyxx.hpp:2806
#define ANY_OP(ret, op, params, const_)
TRAIT operator with default behavior is to call the related operator of the model.
Definition anyxx.hpp:1059
#define ANY_FN(ret, name, params, const_)
TRAIT function whose default behavior is to call an equally named member function of the model.
Definition anyxx.hpp:1019
#define ANY_OP_DEF(access, ret, op, name, params, const_,...)
TRAIT operator with default behavior.
Definition anyxx.hpp:1066
observer< const_void > cref
Definition anyxx.hpp:1863
#define TRAIT_TEMPLATE_EX_(t, n, base, base_template_types, l, static_fns, typedefs, decoration)
TRAIT template with base and decoration.
Definition anyxx.hpp:790
#define TRAIT_TEMPLATE(t, n, l)
TRAIT template.
Definition anyxx.hpp:819
#define ANY_FN_DEF(access, ret, name, params, const_,...)
TRAIT function with default behavior.
Definition anyxx.hpp:998