Utility Rack
Loading...
Searching...
No Matches
forward_capture.hpp
Go to the documentation of this file.
1
25#ifndef FORWARD_CAPTURE_HPP_INCLUDED
26#define FORWARD_CAPTURE_HPP_INCLUDED
27
28#include <tuple>
29#include <utility> // std::forward
30
31#define CHOPS_FWD(...) std::forward<decltype(__VA_ARGS__)>(__VA_ARGS__)
32
33namespace chops {
34
35namespace detail {
36
37template <typename... Ts>
38auto fwd_capture(Ts&&... xs) {
39 return std::tuple<Ts...>(CHOPS_FWD(xs)...);
40}
41
42}
43
44template <typename T>
45decltype(auto) access(T&& x) { return std::get<0>(CHOPS_FWD(x)); }
46
47} // end namespace
48
49#define CHOPS_FWD_CAPTURE(...) chops::detail::fwd_capture(CHOPS_FWD(__VA_ARGS__))
50
51#endif
52