Skip to content

Commit c06d3d5

Browse files
authored
rename _res to _result to avoid macro conflict (#456)
1 parent 2a0fdea commit c06d3d5

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

include/rfl/OneOf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct OneOf {
4343
static rfl::Result<T> validate_impl(const T& _value,
4444
std::vector<Error> _errors) {
4545
return Head::validate(_value)
46-
.and_then([&](auto&& _res) -> rfl::Result<T> {
46+
.and_then([&](auto&& _result) -> rfl::Result<T> {
4747
if constexpr (sizeof...(Tail) == 0) {
4848
if (_errors.size() == sizeof...(Cs)) {
4949
return _value;

include/rfl/Variant.hpp

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -283,103 +283,103 @@ class Variant {
283283
}
284284

285285
template <class F, class ResultType, IndexType... _is>
286-
void do_visit_with_result(F& _f, std::optional<ResultType>* _res,
286+
void do_visit_with_result(F& _f, std::optional<ResultType>* _result,
287287
std::integer_sequence<IndexType, _is...>) {
288288
auto visit_one = [this]<IndexType _i>(const F& _f,
289-
std::optional<ResultType>* _res,
289+
std::optional<ResultType>* _result,
290290
Index<_i>) {
291-
if (!*_res && index_ == _i) {
292-
_res->emplace(_f(get_alternative<_i>()));
291+
if (!*_result && index_ == _i) {
292+
_result->emplace(_f(get_alternative<_i>()));
293293
}
294294
};
295-
(visit_one(_f, _res, Index<_is>{}), ...);
295+
(visit_one(_f, _result, Index<_is>{}), ...);
296296
}
297297

298298
template <class F, class ResultType, IndexType... _is>
299-
void do_visit_with_result(F& _f, std::optional<ResultType>* _res,
299+
void do_visit_with_result(F& _f, std::optional<ResultType>* _result,
300300
std::integer_sequence<IndexType, _is...>) const {
301301
auto visit_one = [this]<IndexType _i>(const F& _f,
302-
std::optional<ResultType>* _res,
302+
std::optional<ResultType>* _result,
303303
Index<_i>) {
304-
if (!*_res && index_ == _i) {
305-
_res->emplace(_f(get_alternative<_i>()));
304+
if (!*_result && index_ == _i) {
305+
_result->emplace(_f(get_alternative<_i>()));
306306
}
307307
};
308-
(visit_one(_f, _res, Index<_is>{}), ...);
308+
(visit_one(_f, _result, Index<_is>{}), ...);
309309
}
310310

311311
template <class F, class ResultType, IndexType... _is>
312-
void do_visit_with_result(const F& _f, std::optional<ResultType>* _res,
312+
void do_visit_with_result(const F& _f, std::optional<ResultType>* _result,
313313
std::integer_sequence<IndexType, _is...>) {
314314
const auto visit_one = [this]<IndexType _i>(const F& _f,
315-
std::optional<ResultType>* _res,
315+
std::optional<ResultType>* _result,
316316
Index<_i>) {
317-
if (!*_res && index_ == _i) {
318-
_res->emplace(_f(get_alternative<_i>()));
317+
if (!*_result && index_ == _i) {
318+
_result->emplace(_f(get_alternative<_i>()));
319319
}
320320
};
321-
(visit_one(_f, _res, Index<_is>{}), ...);
321+
(visit_one(_f, _result, Index<_is>{}), ...);
322322
}
323323

324324
template <class F, class ResultType, IndexType... _is>
325-
void do_visit_with_result(const F& _f, std::optional<ResultType>* _res,
325+
void do_visit_with_result(const F& _f, std::optional<ResultType>* _result,
326326
std::integer_sequence<IndexType, _is...>) const {
327327
const auto visit_one = [this]<IndexType _i>(const F& _f,
328-
std::optional<ResultType>* _res,
328+
std::optional<ResultType>* _result,
329329
Index<_i>) {
330-
if (!*_res && index_ == _i) {
331-
_res->emplace(_f(get_alternative<_i>()));
330+
if (!*_result && index_ == _i) {
331+
_result->emplace(_f(get_alternative<_i>()));
332332
}
333333
};
334-
(visit_one(_f, _res, Index<_is>{}), ...);
334+
(visit_one(_f, _result, Index<_is>{}), ...);
335335
}
336336

337337
template <class F, class ResultType, IndexType... _is>
338-
void do_visit_with_reference(F& _f, ResultType** _res,
338+
void do_visit_with_reference(F& _f, ResultType** _result,
339339
std::integer_sequence<IndexType, _is...>) {
340-
const auto visit_one = [this]<IndexType _i>(const F& _f, ResultType** _res,
340+
const auto visit_one = [this]<IndexType _i>(const F& _f, ResultType** _result,
341341
Index<_i>) {
342-
if (!*_res && index_ == _i) {
343-
*_res = &_f(get_alternative<_i>());
342+
if (!*_result && index_ == _i) {
343+
*_result = &_f(get_alternative<_i>());
344344
}
345345
};
346-
(visit_one(_f, _res, Index<_is>{}), ...);
346+
(visit_one(_f, _result, Index<_is>{}), ...);
347347
}
348348

349349
template <class F, class ResultType, IndexType... _is>
350-
void do_visit_with_reference(F& _f, ResultType** _res,
350+
void do_visit_with_reference(F& _f, ResultType** _result,
351351
std::integer_sequence<IndexType, _is...>) const {
352-
const auto visit_one = [this]<IndexType _i>(const F& _f, ResultType** _res,
352+
const auto visit_one = [this]<IndexType _i>(const F& _f, ResultType** _result,
353353
Index<_i>) {
354-
if (!*_res && index_ == _i) {
355-
*_res = &_f(get_alternative<_i>());
354+
if (!*_result && index_ == _i) {
355+
*_result = &_f(get_alternative<_i>());
356356
}
357357
};
358-
(visit_one(_f, _res, Index<_is>{}), ...);
358+
(visit_one(_f, _result, Index<_is>{}), ...);
359359
}
360360

361361
template <class F, class ResultType, IndexType... _is>
362-
void do_visit_with_reference(const F& _f, ResultType** _res,
362+
void do_visit_with_reference(const F& _f, ResultType** _result,
363363
std::integer_sequence<IndexType, _is...>) {
364-
const auto visit_one = [this]<IndexType _i>(const F& _f, ResultType** _res,
364+
const auto visit_one = [this]<IndexType _i>(const F& _f, ResultType** _result,
365365
Index<_i>) {
366-
if (!*_res && index_ == _i) {
367-
*_res = &_f(get_alternative<_i>());
366+
if (!*_result && index_ == _i) {
367+
*_result = &_f(get_alternative<_i>());
368368
}
369369
};
370-
(visit_one(_f, _res, Index<_is>{}), ...);
370+
(visit_one(_f, _result, Index<_is>{}), ...);
371371
}
372372

373373
template <class F, class ResultType, IndexType... _is>
374-
void do_visit_with_reference(const F& _f, ResultType** _res,
374+
void do_visit_with_reference(const F& _f, ResultType** _result,
375375
std::integer_sequence<IndexType, _is...>) const {
376-
const auto visit_one = [this]<IndexType _i>(const F& _f, ResultType** _res,
376+
const auto visit_one = [this]<IndexType _i>(const F& _f, ResultType** _result,
377377
Index<_i>) {
378-
if (!*_res && index_ == _i) {
379-
*_res = &_f(get_alternative<_i>());
378+
if (!*_result && index_ == _i) {
379+
*_result = &_f(get_alternative<_i>());
380380
}
381381
};
382-
(visit_one(_f, _res, Index<_is>{}), ...);
382+
(visit_one(_f, _result, Index<_is>{}), ...);
383383
}
384384

385385
template <IndexType _i>

include/rfl/parsing/Parser_tagged_union.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct Parser<R, W, TaggedUnion<_discriminator, AlternativeTypes...>,
125125
static void set_if_disc_value_matches(const R& _r,
126126
const std::string& _disc_value,
127127
const InputVarType& _var,
128-
ResultType* _res,
128+
ResultType* _result,
129129
bool* _match_found) noexcept {
130130
using AlternativeType = std::remove_cvref_t<
131131
std::variant_alternative_t<_i, std::variant<AlternativeTypes...>>>;
@@ -156,12 +156,12 @@ struct Parser<R, W, TaggedUnion<_discriminator, AlternativeTypes...>,
156156
if constexpr (no_field_names_) {
157157
using T = tagged_union_wrapper_no_ptr_t<std::invoke_result_t<
158158
decltype(wrap_if_necessary<AlternativeType>), AlternativeType>>;
159-
*_res = Parser<R, W, T, ProcessorsType>::read(_r, _var)
159+
*_result = Parser<R, W, T, ProcessorsType>::read(_r, _var)
160160
.transform(get_fields)
161161
.transform(to_tagged_union)
162162
.transform_error(embellish_error);
163163
} else {
164-
*_res = Parser<R, W, AlternativeType, ProcessorsType>::read(_r, _var)
164+
*_result = Parser<R, W, AlternativeType, ProcessorsType>::read(_r, _var)
165165
.transform(to_tagged_union)
166166
.transform_error(embellish_error);
167167
}

0 commit comments

Comments
 (0)