Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-01-27 22:21:21

Dave Abrahams writes:
> First of all, is there really a conflict? A function called set() doesn't
> conflict with a class template called set<>, does it? Can you show an
> example where the conflict occurs?

I'm not totally sure what the standard says about this... from 3.3.7
I think that the function name is suppose to hide the class name.

However, with g++ 2.91.66, for this code:

  template <class Edge, class Graph, class Weight, class Distance,
            class BinaryOperator, class Vertex>
  bool _relax(Edge e, Graph& g, Weight w, Distance d, BinaryOperator op,
    Vertex u = source(e,g), v = target(e,g);// incident would be nicer
    if (op(get(d,u), get(w,e)) < get(d,v)) {
      set(d, v, op(get(d,u), get(w,e)));
      return true;
    } else
      return false;

I get this error:

/usr/people/jsiek/tlc/ggcl/devel/contrib/new_ggcl/ggcl/relax.hpp:21: use of class template `template <class Key, class Compare = struct less<T>, class Alloc = class alloc> set<Key,Compare,Alloc>' as expression

Whenever client code does this:

#include <set>
#include <ggcl/relax.hpp>

> Second of all, can't people put their property accessors in their *own*
> namespace?

They can as long as I used the unqualified name "set", but they can't
if I use "boost::set". But the unqualified name is more dangerous,
as above.



Boost list run by bdawes at, gregod at, cpdaniel at, john at