Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide

RWTValSet<T,C,A>

Module:  Essential Tools Module   Group:  STL-based Collection


Does not inherit

Local Index

Members

Non-Members

Synopsis

#include <rw/tvset.h> 
RWTValSet<T,C,A> s;

Description

This class maintains a collection of values, which are ordered according to a comparison object of type C. 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.

RWTValSet<T,C,A> will not accept an item that compares equal to an item already in the collection. (RWTValMultiSet<T,C,A> may contain multiple items that compare equal to each other.) Equality is based on the comparison object and not on 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 Standard C++ Library.

Persistence

Isomorphic.

Examples

In this example, a set of RWCStrings is exercised.

Related Classes

Class RWTValMultiSet<T,C,A> offers the same interface to a collection that accepts multiple items that compare equal to each other. RWTValMap<K,T,C,A> maintains a collection of key-value pairs.

Class set<T,C,A> is the C++-standard collection that serves as the underlying implementation for RWTValSet<T,C,A>.

Public Typedefs

typedef set<T,C,A<T> > container_type; 
typedef typename container_type::iterator iterator;
typedef typename container_type::const_iterator
  const_iterator;
typedef typename container_type::size_type size_type;
typedef T value_type; 
typedef const T& const_reference; 

Public Constructors

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

Public Member Operators

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

Public Member Functions

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

Related Global Operators

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


Previous fileTop of DocumentContentsIndex pageNext file

©2004 Copyright Quovadx, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Quovadx, 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.