Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-05-30 12:48:11


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?

template <class Key, class Value, class KeyOfValue,
    class Compare, class Alloc = std::allocator<Value> >
class associative_vector
{
private:
    typedef std::vector<Value> Impl;

[...]

    associative_vector(const Compare& comp, const allocator_type& a)
        : m_key_compare(comp), m_impl(a) {}

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); }

Cheers,

Jeremy Siek

Dave Abrahams writes:
> The associative_vector, vector_set, and vector_multiset templates are
> available in the associative_vector folder in the Files section.
> I have included a very complete test as well. The test is passed on
> MSVC6.3 and GCC 2.95.2
>
> I request a review!
>
> Thanks,
> Dave
>
>
> ------------------------------------------------------------------------
> Accurate impartial advice on everything from laptops to table saws.
> http://click.egroups.com/1/4634/3/_/9351/_/959703960/
> ------------------------------------------------------------------------
>
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk