1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include <iostream>
- #include <array>
- #include <vector>
- using std::cout, std::endl;
- template <class V>
- struct Vec
- {
- V v;
- decltype(v.begin()) p = v.begin();
- };
- template <class V>
- constexpr auto
- vec(V && v)
- {
- return Vec<V> { std::forward<V>(v) };
- }
- int main()
- {
- auto f1 = [] { return std::array {7, 2}; };
- auto f2 = [] { return std::vector {5, 2}; };
- auto v1 = vec(f1());
- auto v2 = vec(f2());
- cout << (v1.v.begin()==v1.p) << endl;
- cout << (v2.v.begin()==v2.p) << endl;
- return 0;
- }
|