Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWTPtrSet<T,C,A>

Module:  Essential Tools Module   Group:  STL-based Collection Classes


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/tpset.h> 
RWTPtrSet<T,C,A> s;

Description

This class maintains a pointer-based collection of values, which are ordered according to a comparison object of type C. Class T is the type pointed to by the items in the collection. C must induce a total ordering on elements of type T via a public member

which returns true if x should precede y within the collection. The structure less<T> from the C++-standard header file <functional> is an example. Note that items in the collection will be dereferenced before being compared.

RWTPtrSet<T,C,A> will not accept an item that compares equal to an item already in the collection. (RWTPtrMultiSet<T,C,A> may contain multiple items that compare equal to each other.) Equality is based on the comparison object and not on the == operator. Given a comparison object comp, items a and b are equal if !comp(a,b) && !comp(b,a).

The value type must have operator== and operator< defined. This requirement is imposed by the C++ Standard Library.

Persistence

Isomorphic

Example

In this example, a pointer-based set of RWCStrings is exercised.

Program output:

Related Classes

Class RWTPtrMultiSet<T,C,A> offers the same interface to a pointer-based collection that accepts multiple items that compare equal to each other. RWTPtrMap<K,T,C,A> is a pointer-based collection of key-value pairs.

Class std::set<T*,rw_deref_compare<C,T>,A<T*> > is the C++-standard collection that serves as the underlying implementation for RWTPtrSet<T,C,A>.

Public Typedefs

typedef rw_deref_compare<C,T> container_comp; 
3.3
typedef typename container_type::size_type size_type; 
typedef typename container_type::difference_type
  difference_type; 
typedef typename container_type::iterator iterator; 
typedef typename container_type::const_iterator
  const_iterator; 
typedef T* value_type; 
typedef T*const& reference; 
typedef T*const& const_reference; 

Public Constructors

RWTPtrSet<T,C,A>(const container_comp& comp =
     container_comp());
RWTPtrSet<T,C,A>(const RWTPtrSet<T,C,A>& rws); 
RWTPtrSet<T,C,A>(const container_type& s);
RWTPtrSet<T,C,A>(T* const* first,T* const* last,
  const container_comp& comp = container_comp());

Public Member Operators

RWTPtrSet<T,C,A>&
operator=(const container_type& s); 
RWTPtrSet<T,C,A>&
operator=(const RWTPtrSet<T,C,A>& s);
bool
operator<(const RWTPtrSet<T,C,A>& s); 
bool
operator==(const RWTPtrSet<T,C,A>& s); 

Public Member Functions

void
apply(void (*fn)(const T*,void*), void* d) const; 
iterator
begin();
const_iterator
begin() const;
void
clear();
void
clearAndDestroy();
bool
contains(const T* a) const; 
bool
contains(bool (*fn)(const T*,void*), void* d) const;
void
difference(const RWTPtrSet<T,C,A>& s); 
iterator
end();
const_iterator
end() const;
size_type
entries() const; 
T*
find(const T* a);
const T*
find(const T* a) const; 
const T*
find(bool (*fn)(const T*,void*), void* d) const;
bool
insert(T* a); 
void
intersection(const RWTPtrSet<T,C,A>& s); 
bool
isEmpty() const; 
bool
isEquivalent(const RWTPtrSet<T,C,A>& s) const; 
bool
isProperSubsetOf(const RWTPtrSet<T,C,A>& s) const; 
bool
isSubsetOf(const RWTPtrSet<T,C,A>& s) const; 
size_type
occurrencesOf(const T* a) const; 
size_type
occurrencesOf(bool (*fn)(T*,void*), void* d);
size_type
occurrencesOf(bool (*fn)(const T*,void*), void* d) const;
T*
remove(const T* a); 
T*
remove(bool (*fn)(const T*,void*), void* d);
size_type
removeAll(const T* a); 
size_type
removeAll(bool (*fn)(const T*,void*), void* d); 
set<T*, container_comp,A<T*> >&
std();
const set<T*, container_comp,A<T*> >&
std() const;
void
symmetricDifference(const RWTPtrSet<T,C,A>& s); 
void
Union(const RWTPtrSet<T,C,A>& s); 

Related Global Operators

RWvostream&
operator<<(RWvostream& strm, const RWTPtrSet<T,C,A>& coll); 
RWFile&
operator<<(RWFile& strm, const RWTPtrSet<T,C,A>& coll);
RWvistream&
operator>>(RWvistream& strm, RWTPtrSet<T,C,A>& coll); 
RWFile&
operator>>(RWFile& strm, RWTPtrSet<T,C,A>& coll);
RWvistream&
operator>>(RWvistream& strm, RWTPtrSet<T,C,A>*& p); 
RWFile&
operator>>(RWFile& strm, RWTPtrSet<T,C,A>*& p);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.