Skip to content

Commit 6853da2

Browse files
Alias fn<A, T>(...) to impl<A, T>::fn(...)
1 parent 422c0f3 commit 6853da2

8 files changed

Lines changed: 21 additions & 17 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct insertable : simply::member_affordance_base {
2424
template <typename Self>
2525
struct simply::iface<insertable, Self> {
2626
friend auto operator<<(std::ostream &out, const Self &self) -> std::ostream & {
27-
return simply::impl<insertable, Self>::fn(self, out);
27+
return simply::fn<insertable, Self>(self, out);
2828
}
2929
};
3030

include/simply/dyn.hpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class dyn
8383
requires simply::destroy_affordance<Affordance>
8484
{
8585
using destroy = simply::destroy_affordance_t<Affordance>;
86-
simply::impl<destroy, dyn>::fn(*this);
86+
simply::fn<destroy, dyn>(*this);
8787
}
8888
};
8989

@@ -116,7 +116,8 @@ concept _allocator_storage_dyn =
116116
simply::allocator_storage>;
117117

118118
template <typename T, typename Dyn>
119-
using _storage_impl_t = simply::impl<typename Dyn::storage_type, T>;
119+
inline constexpr const auto &_storage_fn =
120+
simply::fn<typename Dyn::storage_type, T>;
120121

121122
template <simply::member_affordance Affordance, typename T,
122123
simply::_allocator_storage_dyn Dyn, typename R, typename Self,
@@ -126,9 +127,9 @@ struct impl<simply::impl<Affordance, T>, Dyn,
126127
static constexpr auto fn(Self dyn, Args... args) noexcept(NoExcept) -> R {
127128
using self_type = simply::apply_cvref_t<Self, T>;
128129

129-
const auto pointer = simply::_storage_impl_t<T, Dyn>::fn(dyn.get());
130-
return simply::impl<Affordance, T>::fn(std::forward<self_type>(*pointer),
131-
std::forward<Args>(args)...);
130+
const auto pointer = simply::_storage_fn<T, Dyn>(dyn.get());
131+
return simply::fn<Affordance, T>(std::forward<self_type>(*pointer),
132+
std::forward<Args>(args)...);
132133
}
133134
};
134135

@@ -146,9 +147,9 @@ struct impl<simply::impl<Affordance, T>, Dyn,
146147
dyn.get_allocator(),
147148
std::in_place_type<T>,
148149
simply::elide([&] -> T {
149-
const auto pointer = simply::_storage_impl_t<T, Dyn>::fn(dyn.get());
150-
return simply::impl<Affordance, T>::fn(
151-
std::forward<self_type>(*pointer), std::forward<Args>(args)...);
150+
const auto pointer = simply::_storage_fn<T, Dyn>(dyn.get());
151+
return simply::fn<Affordance, T>(std::forward<self_type>(*pointer),
152+
std::forward<Args>(args)...);
152153
}),
153154
};
154155
}
@@ -167,7 +168,7 @@ struct impl<simply::impl<Affordance, T>, Dyn,
167168
}
168169

169170
auto alloc = simply::_rebind_alloc<T>(dyn.get_allocator());
170-
const auto pointer = simply::_storage_impl_t<T, Dyn>::fn(dyn.get());
171+
const auto pointer = simply::_storage_fn<T, Dyn>(dyn.get());
171172

172173
using traits = std::allocator_traits<decltype(alloc)>;
173174

include/simply/extractable.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct extractable : simply::member_affordance_base {
2222
template <typename In, typename Self>
2323
struct iface<simply::extractable<In>, Self> {
2424
friend constexpr auto operator>>(In &out, const Self &self) -> In & {
25-
return simply::impl<simply::extractable<In>, Self>::fn(self, out);
25+
return simply::fn<simply::extractable<In>, Self>(self, out);
2626
}
2727
};
2828

include/simply/impl.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ struct impl {
1313
static constexpr auto fn = Affordance::template fn<T>;
1414
};
1515

16+
template <typename Affordance, typename T>
17+
inline constexpr const auto &fn = simply::impl<Affordance, T>::fn;
18+
1619
template <simply::member_affordance Affordance, typename T>
1720
struct affordance_traits<Affordance, T> {
1821
using function_type = decltype(Affordance::template fn<T>);

include/simply/insertable.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct insertable : simply::member_affordance_base {
2222
template <typename Out, typename Self>
2323
struct iface<simply::insertable<Out>, Self> {
2424
friend constexpr auto operator<<(Out &out, const Self &self) -> Out & {
25-
return simply::impl<simply::insertable<Out>, Self>::fn(self, out);
25+
return simply::fn<simply::insertable<Out>, Self>(self, out);
2626
}
2727
};
2828

include/simply/storage.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ struct iface<Storage, Self> {
7979
object_ptr(
8080
other.valueless_after_move()
8181
? nullptr
82-
: simply::impl<
82+
: simply::fn<
8383
simply::copy_affordance_t<typename Self::affordance_type>,
84-
Self>::fn(static_cast<const Self &>(other))
84+
Self>(static_cast<const Self &>(other))
8585
._release()) {}
8686

8787
constexpr iface(iface &&other) noexcept

include/simply/vtable.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ inline constexpr simply::vtable<Affordance, Self>
4242
template <simply::member_affordance Affordance, typename Self, typename T>
4343
inline constexpr simply::vtable<Affordance, Self>
4444
vtable_for<Affordance, Self, T> = {
45-
.fn = &simply::impl<simply::impl<Affordance, T>, Self>::fn,
45+
.fn = &simply::fn<simply::impl<Affordance, T>, Self>,
4646
};
4747

4848
} // namespace simply

tests/counters.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ struct labeled : simply::member_affordance_base {
4646
template <typename CountT, typename Self>
4747
struct simply::iface<copy_countable<CountT>, Self> {
4848
constexpr auto copy_count(this const Self &self) -> CountT {
49-
return simply::impl<copy_countable<CountT>, Self>::fn(self);
49+
return simply::fn<copy_countable<CountT>, Self>(self);
5050
}
5151
};
5252

5353
template <typename LabelT, typename Self>
5454
struct simply::iface<labeled<LabelT>, Self> {
5555
constexpr auto label(this const Self &self) -> LabelT {
56-
return simply::impl<labeled<LabelT>, Self>::fn(self);
56+
return simply::fn<labeled<LabelT>, Self>(self);
5757
}
5858
};
5959

0 commit comments

Comments
 (0)