Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-04-21 09:07:56


> Why not? are your views CopyConstructible and Assignable?
Yes, although it does depend on the underlying container.

> > If you always write:
> > using std::swap;
> > swap(view, view)
> >
> > and I have my own swap in my namespace (which for the moment doesn't
> compile
> > but I will work on this.) we can rely on Koening lookup to find the
> correct
> > swap and use that.
>
> Yes, I'm well aware of the available techniques and the drawbacks of each.
>
>
> Koenig lookup doesn't operate differently inside member function bodies as
> far as I know. Did I miss something?
>
As I understand it:
From: Alan Grithiths

    void UserClass::swap(UserClass& lhs, UserClass& rhs) {
        using std::swap;
        swap(lhs.data, rhs.data); // always calls std::swap
    }
If it is a member function, then it will find std::swap<>. (Argument
dependent lookup aborts if a class member function name matches.)

Fix:
    void UserClass::swap(UserClass& lhs, UserClass& rhs) {
        ::viewnamespace::swap(lhs.view, rhs.view); // calls
viewnamespace::swap
    }

Unless this whole class is
template<class DataType> structUserClass {
DataType view;
};

In which case there is no way to know the ::viewnamespace .

Where Koenig lookup does include candidates from the namespace that
includes data_type.
    // Canonical example
    template<typename UserClass>
    void swap(UserClass& lhs, UserClass& rhs) {
        using std::swap;
        swap(lhs, rhs);
    }

Where Koenig lookup does include candidates from the namespace that
includes data_type.

I'd be glad to follow the std but its really broken in this case.

Re:hash_map

It's a commonly used container, I need the trait<hash_map>, SGI put it in
the namespace std, Its not std,
 What would you like?
a) A seperate include file that can be used or not by users of hash_map.
b) use of defines to recognize that SGI STL is being used. And include the
file <hash_map> ?

This isn't important to me. I'm just trying to make this library as standard
complient as possible. It's just frustrating.

  -gary-

PS
 I'm in the process of converting the files to .hpp, and making forward
includes. I can't very well complain about the lack of them, and then not
provide them myself.


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