|
Boost : |
From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-05-30 14:52:52
--- In boost_at_[hidden], jsiek_at_l... wrote:
> Hi Dave,
>
> A quick first glance at the code brought up 2 issues for me:
>
> 1. It seems to me that if someone provides their own allocator there
> is going to be a compiler error, since the Alloc parameter is not
used
> in the typedef for Impl. Or am I missing something?
Yikes! Good catch. Serves me right for not testing allocator
parametrization!
> 2. I've got the exact same code sitting in GGCL. How about we
> put tied in utility.hpp?
>
> template <class X, class Y>
> struct tied
> {
> tied(X& x, Y& y) : m_x(x), m_y(y) {}
>
> template <class T1, class T2>
> void operator=(const std::pair<T1,T2>& p)
> { m_x = p.first; m_y = p.second; }
> mutable X& m_x;
> mutable Y& m_y;
> };
>
> template <class X, class Y>
> tied<X, Y> tie(X& x, Y& y) { return tied<X,Y>(x,y); }
Well, I think that code is just detritus; I was using it but ended up
refactoring the code and all the uses went away, so I should just
take it out of the test. OTOH I agree that this idiom is a great idea
for utility.hpp.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk