Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-01-13 13:00:00


Hi Reid,

Just to clarify a bit, what I'm proposing here is a *concept* (in the
SGI STL sense of the word), not an actual class. It's an abstract set
of requirements that a number of classes could potentially fulfill.

In addition, the concept I was aiming at, as Kevlin pointed out,
should not be called a Bag because it does not have the set operations
(its closer to the idea of a stack or queue).

However, you make a great point in that there is also need for the true
Bag concept and some good classes that fulfill the requirements.
Here's a stab at the true Bag concept:

concept Bag
  refines Collection

  pair<bool,iterator> insert(const T& val);
  size_type erase(const T& val);
  iterator find(const T& val);

With the requirement for Collection, all the STL set operations can
be performed on a Bag.

Then, as you suggested, there are several interesting ways to
implement a Bag... (std::set is one of them)

Cheers,

Jeremy

----------------------------------------------------------------------
 Jeremy Siek
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (650) 933-8724
 and cell phone: (415) 377-5814
 C++ Library & Compiler Group fax: (650) 932-0127
 SGI www: http://www.lsc.nd.edu/~jsiek/
----------------------------------------------------------------------


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