phdMesh  Version of the Day
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
Public Types | Public Member Functions | Static Public Member Functions | List of all members
phdmesh::Setv< ValueType, KeyCompare, Allocator > Class Template Reference

Associative container of explictly managed entities. More...

#include <Setv.hpp>

Public Types

typedef ValueType::key_type key_type
 Type of the comparison keys, obtained from the member class.
 
typedef ValueType value_type
 Type of the members.
 
typedef KeyCompare key_compare
 Key comparison operator.
 
typedef Allocator allocator_type
 Allocator class.
 

Public Member Functions

 Setv (const key_compare &arg_compare=key_compare(), const allocator_type &arg_alloc=allocator_type())
 Construct with comparison and allocator.
 
 Setv (const Setv< value_type, key_compare, allocator_type > &)
 Copy construction.
 
Setv< value_type, key_compare,
allocator_type > & 
operator= (const Setv< value_type, key_compare, allocator_type > &)
 Assignment.
 
allocator_type get_allocator () const
 Allocator.
 
bool empty () const
 Query if container is empty.
 
size_type size () const
 Query number of members.
 
size_type max_size () const
 Query capacity.
 
key_compare key_comp () const
 Comparison operator for key type.
 
value_compare value_comp () const
 Comparison operator for key type via the value type.
 
value_typeoperator[] (const key_type &key)
 Retrieve or create a value with the given key.
 
iterator find (const key_type &) const
 Find a member with a given key.
 
size_type count (const key_type &) const
 Count number of members with a given key, zero or one.
 
iterator lower_bound (const key_type &) const
 First member with key equal to or greater than the given key.
 
iterator upper_bound (const key_type &) const
 Last member with key greater than or equal to the given key.
 
bool verify_ordering () const
 Verify that iteration of the container is properly ordered.
 
Iteration
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
Setv modifiers
std::pair< iterator, bool > insert (const key_type &key, value_type *value=NULL)
 Inserts the given entity with key() == key. More...
 
std::pair< iterator, bool > insert (value_type *)
 Insert the given entity with its key already set.
 
void erase (iterator position)
 Destroys the member referenced by the iterator.
 
void erase (value_type *)
 Destroys the member referenced by the pointer.
 
size_type erase (const key_type &)
 Destroys the member referenced by the key.
 
void remove (value_type &v)
 Removes the member from container but does not destroy it. The caller assumes responsibility for the entity.
 
void clear ()
 Destroys all members.
 

Static Public Member Functions

static Setv< value_type,
key_compare, allocator_type > * 
container (const value_type &)
 Query the container for a given member.
 

Detailed Description

template<class ValueType, class KeyCompare = std::less<typename ValueType::key_type>, class Allocator = std::allocator<ValueType>>
class phdmesh::Setv< ValueType, KeyCompare, Allocator >

Associative container of explictly managed entities.

This associative container is conceptually similar to the std::set container. However, its members may be explicitly managed by the user as opposed to the container always creating internal copies of entities.

Parameters
ValueTypeMember type that must be derived from the SetvMember class.
KeyCompareComparison operator for the KeyType provided to the SetvMember< KeyType > template class.

Definition at line 320 of file Setv.hpp.

Member Function Documentation

template<class ValueType , class KeyCompare = std::less<typename ValueType::key_type>, class Allocator = std::allocator<ValueType>>
std::pair<iterator,bool> phdmesh::Setv< ValueType, KeyCompare, Allocator >::insert ( const key_type key,
value_type value = NULL 
)

Inserts the given entity with key() == key.

If return.second == true then the input entity

  • was removed from its previous container,
  • was allocated if the input value was NULL,
  • had its key() set to 'key', and
  • was inserted into this container.

If return.second == false then an existing value was found and returned and the input value is untouched.

The value must be individually deallocatable via the allocator_type, i.e. allocator.deallocate(value,1) is valid.


The documentation for this class was generated from the following file: