Feature #718

Add Tie

Added by Miroslav Fidler over 10 years ago. Updated over 10 years ago.

Status:ApprovedStart date:03/12/2014
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-Spent time:-
Target version:-

Description

template <class A, class B>
struct Tie2 {
A& a;
B& b;

void operator=(const Tuple2&lt;A, B&gt;& s) { a = s.a; b = s.b; }
Tie2(A& a, B& b) : a(a), b(b) {}
};

template <class A, class B>
Tie2<A, B> Tie(A& a, B& b) { return Tie2<A, B>(a, b); }

CONSOLE_APP_MAIN {
// std::initializer_list<Tuple2<int, int>> l = { {1, 2}, {3, 4} };
// for(auto x: l)
// DDUMP;

Tuple2&lt;int, int&gt; x = MakeTuple(1, 2);
int a, b;
Tie(a, b) = x;

History

#1 Updated by Miroslav Fidler over 10 years ago

  • Status changed from New to Approved

Also available in: Atom PDF