@@ -42,124 +42,118 @@ template <class SF>
4242struct RandomAccessAt {
4343 MemLayout::size_t i;
4444 template <class ... Args>
45- [[gnu::always_inline]] constexpr SF operator ()(Args& ...args) const { return {args[i]...}; }
45+ constexpr SF operator ()(Args& ...args) const { return {args[i]...}; }
4646 template <class ... Args>
47- [[gnu::always_inline]] constexpr SF operator ()(const Args& ...args) const { return {args[i]...}; }
47+ constexpr SF operator ()(const Args& ...args) const { return {args[i]...}; }
4848};
4949
5050template <class SF >
5151struct GetPointer {
5252 template <class ... Args>
53- [[gnu::always_inline]] constexpr SF operator ()(Args& ...args) const { return {&args...}; }
53+ constexpr SF operator ()(Args& ...args) const { return {&args...}; }
5454 template <class ... Args>
55- [[gnu::always_inline]] constexpr SF operator ()(const Args& ...args) const { return {&args...}; }
55+ constexpr SF operator ()(const Args& ...args) const { return {&args...}; }
5656};
5757
5858template <class SF >
5959struct AggregateConstructor {
6060 template <class ... Args>
61- [[gnu::always_inline]] constexpr SF operator ()(Args& ...args) const { return {args...}; }
61+ constexpr SF operator ()(Args& ...args) const { return {args...}; }
6262 template <class ... Args>
63- [[gnu::always_inline]] constexpr SF operator ()(const Args& ...args) const { return {args...}; }
63+ constexpr SF operator ()(const Args& ...args) const { return {args...}; }
6464};
6565
6666template <class SF >
6767struct PreIncrement {
6868 template <class ... Args>
69- [[gnu::always_inline]] constexpr SF operator ()(Args& ...args) const { return {++args...}; }
69+ constexpr SF operator ()(Args& ...args) const { return {++args...}; }
7070};
7171
7272template <class SF >
7373struct PreDecrement {
7474 template <class ... Args>
75- [[gnu::always_inline]] constexpr SF operator ()(Args& ...args) const { return {--args...}; }
75+ constexpr SF operator ()(Args& ...args) const { return {--args...}; }
7676};
7777
7878template <class SF >
7979struct Advance {
8080 ptrdiff_t i;
8181 template <class ... Args>
82- [[gnu::always_inline]] constexpr SF operator ()(const Args& ...args) const { return {(args + i)...}; }
82+ constexpr SF operator ()(const Args& ...args) const { return {(args + i)...}; }
8383};
8484
8585struct CopyAssignment {
8686 template <class Left , class Right >
87- [[gnu::always_inline]] constexpr Left& operator ()(Left& left, const Right& right) const { return left = right; }
87+ constexpr Left& operator ()(Left& left, const Right& right) const { return left = right; }
8888};
8989
9090// ////////////// apply to members methods
9191
92- struct apply_unary_helper {
93- template <class Self , class FunctionObject , size_t ... Is>
94- [[gnu::always_inline]] constexpr auto operator ()(Self& self, FunctionObject&& f, std::index_sequence<Is...>) const {
95- return f (self.[:nsdms (^^Self)[Is]:]...);
96- }
97- };
98-
9992template <class Self , class FunctionObject >
100- [[gnu::always_inline]] constexpr auto apply_unary (Self &self, FunctionObject&& f) {
93+ constexpr auto apply_unary (Self &self, FunctionObject&& f) {
94+ auto construct_output = [&]<size_t ... Is>(std::index_sequence<Is...>) {
95+ return f (self.[:nsdms (^^Self)[Is]:]...);
96+ };
10197 constexpr auto indices = std::make_index_sequence<count_members<Self>()>{};
102- return apply_unary_helper{}(self, std::forward<FunctionObject>(f), indices);
98+ return construct_output ( indices);
10399}
104100
105101// apply on skeleton struct S<F>
106102template <class FunctionObject , template <template <class > class > class S , template <class > class F >
107- [[gnu::always_inline]] constexpr auto apply (S<F> &self, FunctionObject&& f) {
103+ constexpr auto apply (S<F> &self, FunctionObject&& f) {
108104 return apply_unary (self, std::forward<FunctionObject&&>(f));
109105}
110106
111107template <class FunctionObject , template <template <class > class > class S , template <class > class F >
112- [[gnu::always_inline]] constexpr auto apply (const S<F> &self, FunctionObject&& f) {
108+ constexpr auto apply (const S<F> &self, FunctionObject&& f) {
113109 return apply_unary (self, std::forward<FunctionObject&&>(f));
114110}
115111
116112// apply on wrappers, forwarding to the base type
117113template <class FunctionObject , class Self >
118114 requires requires { typename Self::Base; }
119- [[gnu::always_inline]] constexpr auto apply (Self &self, FunctionObject&& f) {
115+ constexpr auto apply (Self &self, FunctionObject&& f) {
120116 return apply_unary<typename Self::Base>(self, std::forward<FunctionObject&&>(f));
121117}
122118
123119template <class FunctionObject , class Self >
124120 requires requires { typename Self::Base; }
125- [[gnu::always_inline]] constexpr auto apply (const Self &self, FunctionObject&& f) {
121+ constexpr auto apply (const Self &self, FunctionObject&& f) {
126122 return apply_unary<const typename Self::Base>(self, std::forward<FunctionObject&&>(f));
127123}
128124
129- struct apply_binary_helper {
130- template <class Self , class Other , class FunctionObject , size_t ... Is>
131- [[gnu::always_inline]] constexpr Self operator ()(Self& self, Other& other, FunctionObject&& f, std::index_sequence<Is...>) const {
132- return {f (self.[:nsdms (^^Self)[Is]:], other.[:nsdms (^^Other)[Is]:])...};
133- }
134- };
135125
136126// template <class FunctionObject, class Self, class Other>
137127// constexpr auto apply(Self &self, Other &other, FunctionObject&& f) {
138128template <class Self , class Other , class FunctionObject >
139- [[gnu::always_inline]] constexpr auto apply_binary (Self &self, Other &other, FunctionObject&& f) {
129+ constexpr auto apply_binary (Self &self, Other &other, FunctionObject&& f) {
130+ auto construct_output = [&]<size_t ... Is>(std::index_sequence<Is...>) -> Self {
131+ return {f (
132+ self.[:nsdms (^^Self)[Is]:], other.[:nsdms (^^Other)[Is]:])...};
133+ };
140134 constexpr auto indices = std::make_index_sequence<count_members<Self>()>{};
141- return apply_binary_helper{}(self, other, std::forward<FunctionObject&&>(f), indices);
135+ return construct_output ( indices);
142136}
143137
144138template <class FunctionObject , template <template <class > class > class S , template <class > class F_self , template <class > class F_other >
145- [[gnu::always_inline]] constexpr auto apply (S<F_self> &self, S<F_other> &other, FunctionObject&& f) {
139+ constexpr auto apply (S<F_self> &self, S<F_other> &other, FunctionObject&& f) {
146140 return apply_binary (self, other, std::forward<FunctionObject&&>(f));
147141}
148142
149143template <class FunctionObject , template <template <class > class > class S , template <class > class F_self , template <class > class F_other >
150- [[gnu::always_inline]] constexpr auto apply (S<F_self> &self, const S<F_other> &other, FunctionObject&& f) {
144+ constexpr auto apply (S<F_self> &self, const S<F_other> &other, FunctionObject&& f) {
151145 return apply_binary (self, other, std::forward<FunctionObject&&>(f));
152146}
153147
154148template <class Self , class Other , class FunctionObject >
155149 requires requires { typename Self::Base; typename Other::Base; }
156- [[gnu::always_inline]] constexpr auto apply (Self &self, Other &other, FunctionObject&& f) {
150+ constexpr auto apply (Self &self, Other &other, FunctionObject&& f) {
157151 return apply_binary<typename Self::Base, typename Other::Base>(self, other, std::forward<FunctionObject&&>(f));
158152}
159153
160154template <class Self , class Other , class FunctionObject >
161155 requires requires { typename Self::Base; typename Other::Base; }
162- [[gnu::always_inline]] constexpr auto apply (Self &self, const Other &other, FunctionObject&& f) {
156+ constexpr auto apply (Self &self, const Other &other, FunctionObject&& f) {
163157 static_assert (count_members<typename Self::Base>() == 4 );
164158 return apply_binary<typename Self::Base, const typename Other::Base>(self, other, std::forward<FunctionObject&&>(f));
165159}
@@ -180,13 +174,13 @@ struct wrapper : public S<F> {
180174 template <template <class > class F_other >
181175 constexpr wrapper (const S<F_other>& other) : Base{apply (other, AggregateConstructor<Base>{})} {}
182176
183- [[gnu::always_inline]] constexpr wrapper<S, reference> operator [] (size_t i) {
177+ constexpr wrapper<S, reference> operator [] (size_t i) {
184178 return apply (*this , RandomAccessAt<S<reference>>{i}); }
185- [[gnu::always_inline]] constexpr wrapper<S, const_reference> operator [] (size_t i) const {
179+ constexpr wrapper<S, const_reference> operator [] (size_t i) const {
186180 return apply (*this , RandomAccessAt<S<const_reference>>{i}); }
187181
188- [[gnu::always_inline]] constexpr wrapper<S, reference> operator *() { return operator [](0 ); }
189- [[gnu::always_inline]] constexpr wrapper<S, const_reference> operator *(ptrdiff_t ) const { return operator [](0 ); }
182+ constexpr wrapper<S, reference> operator *() { return operator [](0 ); }
183+ constexpr wrapper<S, const_reference> operator *(ptrdiff_t ) const { return operator [](0 ); }
190184};
191185
192186template <template <template <class > class > class S >
@@ -321,15 +315,15 @@ struct wrapper<S, pointer> : public S<pointer> {
321315 constexpr wrapper () = default;
322316 constexpr wrapper (Base b) : Base{static_cast <Base&&>(b)} {}
323317
324- [[gnu::always_inline]] constexpr wrapper<S, reference> operator [] (size_t i) {
318+ constexpr wrapper<S, reference> operator [] (size_t i) {
325319 return apply (*this , RandomAccessAt<S<reference>>{i}); }
326- [[gnu::always_inline]] constexpr const wrapper<S, const_reference> operator [] (size_t i) const {
320+ constexpr const wrapper<S, const_reference> operator [] (size_t i) const {
327321 return apply (*this , RandomAccessAt<S<const_reference>>{i}); }
328322
329- [[gnu::always_inline]] constexpr wrapper<S, reference> operator *() { return operator [](0 ); }
330- [[gnu::always_inline]] constexpr wrapper<S, const_reference> operator *() const { return operator [](0 ); }
331- [[gnu::always_inline]] constexpr wrapper<S, reference> operator ->() { return operator [](0 ); }
332- [[gnu::always_inline]] constexpr wrapper<S, const_reference> operator ->() const { return operator [](0 ); }
323+ constexpr wrapper<S, reference> operator *() { return operator [](0 ); }
324+ constexpr wrapper<S, const_reference> operator *() const { return operator [](0 ); }
325+ constexpr wrapper<S, reference> operator ->() { return operator [](0 ); }
326+ constexpr wrapper<S, const_reference> operator ->() const { return operator [](0 ); }
333327
334328 constexpr bool operator ==(const wrapper& other) const {
335329 return this ->[:nsdms (^^Base)[0 ]:] == other.[:nsdms (^^Base)[0 ]:]; }
@@ -363,16 +357,16 @@ struct wrapper<S, const_pointer> : public S<const_pointer> {
363357 constexpr wrapper (Base b) : Base{static_cast <Base&&>(b)} {}
364358 constexpr wrapper (const S<pointer>& other) : Base(apply(other, AggregateConstructor<Base>{})) {}
365359
366- [[gnu::always_inline]] constexpr wrapper<S, const_reference> operator [] (size_t i) const {
360+ constexpr wrapper<S, const_reference> operator [] (size_t i) const {
367361 return apply (*this , RandomAccessAt<S<const_reference>>{i}); }
368- [[gnu::always_inline]] constexpr wrapper<S, const_reference> operator *() const { return operator [](0 ); }
369- [[gnu::always_inline]] constexpr wrapper<S, const_reference> operator ->() const { return operator [](0 ); }
362+ constexpr wrapper<S, const_reference> operator *() const { return operator [](0 ); }
363+ constexpr wrapper<S, const_reference> operator ->() const { return operator [](0 ); }
370364
371- [[gnu::always_inline]] constexpr bool operator ==(const wrapper& other) const {
365+ constexpr bool operator ==(const wrapper& other) const {
372366 return this ->[:nsdms (^^Base)[0 ]:] == other.[:nsdms (^^Base)[0 ]:]; }
373- [[gnu::always_inline]] constexpr bool operator !=(const wrapper& other) const {
367+ constexpr bool operator !=(const wrapper& other) const {
374368 return !this ->operator ==(other); }
375- [[gnu::always_inline]] constexpr bool operator <(const wrapper& other) const {
369+ constexpr bool operator <(const wrapper& other) const {
376370 return this ->[:nsdms (^^Base)[0 ]:] < other.[:nsdms (^^Base)[0 ]:]; }
377371
378372 constexpr wrapper operator +(ptrdiff_t i) const {
0 commit comments