Skip to content

Commit

Permalink
Add more forwards. (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadden committed Dec 17, 2020
1 parent 9c2ba55 commit 459f43b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/alia/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ struct is_invocable
// ALIA_LAMBDIFY(f) produces a lambda that calls f, which is essentially a
// version of f that can be passed as an argument and still allows normal
// overload resolution.
#define ALIA_LAMBDIFY(f) [](auto&&... args) { return f(args...); }
#define ALIA_LAMBDIFY(f) \
[](auto&&... args) { return f(std::forward<decltype(args)>(args)...); }
#ifndef ALIA_STRICT_MACROS
#define alia_lambdify(f) ALIA_LAMBDIFY(f)
#endif
Expand All @@ -103,7 +104,8 @@ struct is_invocable
// aggregate expression (i.e., "{args...}") and passes that into f.
// This is useful, for example, when you want to explicitly refer to the
// aggregate constructor of a type as an invocable function.
#define ALIA_AGGREGATOR(f) [](auto&&... args) { return f{args...}; }
#define ALIA_AGGREGATOR(f) \
[](auto&&... args) { return f{std::forward<decltype(args)>(args)...}; }
#ifndef ALIA_STRICT_MACROS
#define alia_aggregator(f) ALIA_AGGREGATOR(f)
#endif
Expand Down

0 comments on commit 459f43b

Please sign in to comment.