Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <type_traits>
- #include <utility>
- #include <list>
- #include <vector>
- #include <deque>
- struct F
- {
- using V = std::vector< float >;
- using L = std::list< double >;
- using D = std::deque< long double >;
- template<
- typename T0, typename = typename std::enable_if< std::is_same< typename std::decay< T0 >::type, V >::value >::type,
- typename T1, typename = typename std::enable_if< std::is_same< typename std::decay< T1 >::type, L >::value >::type,
- typename T2, typename = typename std::enable_if< std::is_same< typename std::decay< T2 >::type, D >::value >::type
- >
- constexpr
- F(T0 && _v,
- T1 && _l,
- T2 && _d)
- : v_(std::forward< T0 >(_v))
- , l_(std::forward< T1 >(_l))
- , d_(std::forward< T2 >(_d))
- { ; }
- private :
- V const v_;
- L const l_;
- D const d_;
- };
- int main()
- {
- using V = typename F::V;
- using L = typename F::L;
- using D = typename F::D;
- V v;
- V const cv;
- L l;
- L const cl;
- D d;
- D const cd;
- F(v, l, d);
- F(cv, cl, cd);
- F(V{1.0f, 2.0f}, L{3.0, 4.0}, D{5.0L, 6.0L});
- // most interesting are below
- F(v, l, cd);
- F(v, cl, d);
- F(cv, l, d);
- F(v, cl, cd);
- F(cv, cl, d);
- F(cv, l, cd);
- // ... I know you know how to continue
- return 0;
- }
Add Comment
Please, Sign In to add comment