?

Log in

No account? Create an account
Макс Лапшин's Journal
 
[Most Recent Entries] [Calendar View] [Friends View]

Friday, June 30th, 2006

Time Event
12:55a

template 
[Error: Irreparable invalid markup ('<class [...] l,>') in entry. Owner must fix manually. Raw contents below.]

<pre><code>
template <class L, class R>
class MinResult {
L& lhs_;
R& rhs_;
public:
operator L&() { return lhs_ < rhs_ ? lhs_ : rhs_; }
operator R&() { return lhs_ < rhs_ ? lhs_ : rhs_; }
MinResult(L& lhs, R& rhs) : lhs_(lhs), rhs_(rhs) {}
};

template <class LR>
class MinResult<LR, LR> {
LR& lhs_;
LR& rhs_;
public:
operator LR() { return lhs_ < rhs_ ? lhs_ : rhs_; }
MinResult(LR& lhs, LR& rhs) : lhs_(lhs), rhs_(rhs) {}
};

template <class L, class R>
MinResult min(L lhs, R rhs)
{
return MinResult(lhs, rhs);
}
</code></pre>

Познакомьтесь. Это min(a, b). Правда, Александреску стоит меньше курить этой травы?

<< Previous Day 2006/06/30
[Calendar]
Next Day >>
My Website   About LiveJournal.com