Home Libraries Author Links

SmartptrAids: Smart Pointer Aids
[SysToMath Aids C++ Library]

Collaboration diagram for SmartptrAids: Smart Pointer Aids:

Detailed Description

Declaration of class templates for smart pointer aids.

The declarations are all contained in the namespace stm::smartptr. They provide the class template injective_ptr for smart pointers pointing to unique constant objects managed by a static repository together with its associated container class template injective_set as well as the traits class templates injective and bijective. For convenience these class templates names are lifted to namespace stm.

As the smart pointer class templates injective_ptr provides boost serialization support, the needed boost::archive and boost::serialization header files are included. Because boost serialization requires that all boost::archive header files are included before any boost::serialization header files, it is recommended to include this header file after all user specific boost::archive headers and before all user specific boost::serialization headers.

In the following class template documentation the international standard C++ISO/IEC 14882:2003(E) is cited in the form of parenthesized expressions with the same syntax and semantics as inside this international standard itself.


Files

file  smartptraids.hpp
 Declarations of smart pointer aids.

Namespaces

namespace  stm::smartptr
 Namespace for all smart pointer aids class templates.

Modules

 SmartptrAids Test
 Demonstration of the usage and tests of the implementation of the SysToMath Aids C++ Library module SmartptrAids.

Classes

struct  stm::smartptr::policy< Flags >
 Class template serving as Policy template parameter for class templates injective_ptr and injective_set. More...
struct  stm::smartptr::MakeSurjective< Policy >
 Class template serving as wrapper of template parameter Policy to ensure the surjective policy property. More...
struct  stm::smartptr::MakeMultirange< Policy >
 Class template serving as wrapper of template parameter Policy to ensure the multirange policy property. More...
class  stm::smartptr::injective_ptr< T, Compare, Allocator, Policy >
 The class template injective_ptr is a smart pointer pointing to unique constant objects of element type T stored using a static repository. More...
class  stm::smartptr::injective_set< T, Compare, Allocator, Policy >
 The class template injective_set is a container of unique constant objects of value type T stored wrapping a specific range of the static repository of an injective_ptr<T, Compare, Allocator, Policy> object. More...
class  stm::smartptr::injective< T, Compare, Allocator, Policy >
 The traits class template injective combines the class template injective_ptr and its associated class template injective_set having either the surjective or the not surjective policy property. More...
class  stm::smartptr::bijective< T, Compare, Allocator, Policy >
 The traits class template bijective combines the class template injective_ptr and its associated class template injective_set having the surjective policy property. More...

Policy Flags

The policy flag bits are bitwise orable.

const stm::dword stm::smartptr::Surjective = 0x00000001
 Surjective policy flag.
const stm::dword stm::smartptr::Multirange = 0x00000002
 Multirange policy flag.

Functions

template<class T, class Compare, class Allocator, class Policy>
bool stm::smartptr::operator== (const injective_ptr< T, Compare, Allocator, Policy > &ptr1, const injective_ptr< T, Compare, Allocator, Policy > &ptr2)
 Returns true, if both ptr1 and ptr2 are empty or ptr1 and ptr2 are not empty and point to elements being equivalent under the equivalence relation induced by Compare, else false.
template<class T, class Compare, class Allocator, class Policy>
bool stm::smartptr::operator!= (const injective_ptr< T, Compare, Allocator, Policy > &ptr1, const injective_ptr< T, Compare, Allocator, Policy > &ptr2)
 Returns true, if either ptr1 or ptr2 is not empty and ptr1 or ptr2 is empty or else point to elements being non-equivalent under the equivalence relation induced by Compare, else false.
template<class T, class Compare, class Allocator, class Policy>
bool stm::smartptr::operator< (const injective_ptr< T, Compare, Allocator, Policy > &ptr1, const injective_ptr< T, Compare, Allocator, Policy > &ptr2)
 Returns a bool value such that operator< is a strict weak ordering as decribed in (25.3) and that under the equivalence relation.
template<class T, class Compare, class Allocator, class Policy>
void stm::smartptr::swap (injective_ptr< T, Compare, Allocator, Policy > &ptr1, injective_ptr< T, Compare, Allocator, Policy > &ptr2)
 Exchanges the contents of the injective_ptr objects ptr1 and ptr2.
template<class T, class Compare, class Allocator, class Policy>
const T * stm::smartptr::get_pointer (const injective_ptr< T, Compare, Allocator, Policy > &ptr)
 Returns a constant pointer to the element pointed to by the injective_ptr object ptr, if ptr is not be empty, else the null pointer.
template<class OStreamT, class T, class Compare, class Allocator, class Policy>
OStreamT & stm::smartptr::operator<< (OStreamT &os, const injective_ptr< T, Compare, Allocator, Policy > &ptr)
 Inserts a string representation of the address of the element pointed to by ptr into the output stream os.


Function Documentation

template<class T, class Compare, class Allocator, class Policy>
bool stm::smartptr::operator== ( const injective_ptr< T, Compare, Allocator, Policy > &  ptr1,
const injective_ptr< T, Compare, Allocator, Policy > &  ptr2 
)

Returns true, if both ptr1 and ptr2 are empty or ptr1 and ptr2 are not empty and point to elements being equivalent under the equivalence relation induced by Compare, else false.

Never throws.

Examples:
smartptrtest.cpp.

template<class T, class Compare, class Allocator, class Policy>
bool stm::smartptr::operator!= ( const injective_ptr< T, Compare, Allocator, Policy > &  ptr1,
const injective_ptr< T, Compare, Allocator, Policy > &  ptr2 
)

Returns true, if either ptr1 or ptr2 is not empty and ptr1 or ptr2 is empty or else point to elements being non-equivalent under the equivalence relation induced by Compare, else false.

Never throws.

template<class T, class Compare, class Allocator, class Policy>
bool stm::smartptr::operator< ( const injective_ptr< T, Compare, Allocator, Policy > &  ptr1,
const injective_ptr< T, Compare, Allocator, Policy > &  ptr2 
)

Returns a bool value such that operator< is a strict weak ordering as decribed in (25.3) and that under the equivalence relation.

     ! (ptr1 < ptr2) && ! (ptr2 < ptr1)
defined by operator<, two injective_ptr instances ptr1 and ptr2 are equivalent if and only if they point to values being equivalent under the equivalence relation induced by Compare or are both empty. An empty injective_ptr object is less than any non-empty injective_ptr object. This allows injective_ptr objects to be used as keys in associative containers. Never throws.

template<class T, class Compare, class Allocator, class Policy>
void stm::smartptr::swap ( injective_ptr< T, Compare, Allocator, Policy > &  ptr1,
injective_ptr< T, Compare, Allocator, Policy > &  ptr2 
)

Exchanges the contents of the injective_ptr objects ptr1 and ptr2.

Never throws.

template<class T, class Compare, class Allocator, class Policy>
const T* stm::smartptr::get_pointer ( const injective_ptr< T, Compare, Allocator, Policy > &  ptr  ) 

Returns a constant pointer to the element pointed to by the injective_ptr object ptr, if ptr is not be empty, else the null pointer.

Never throws.

template<class OStreamT, class T, class Compare, class Allocator, class Policy>
OStreamT& stm::smartptr::operator<< ( OStreamT &  os,
const injective_ptr< T, Compare, Allocator, Policy > &  ptr 
)

Inserts a string representation of the address of the element pointed to by ptr into the output stream os.


Variable Documentation

const stm::dword stm::smartptr::Surjective = 0x00000001

Surjective policy flag.

Definition at line 134 of file smartptraids.hpp.

const stm::dword stm::smartptr::Multirange = 0x00000002

Multirange policy flag.

Definition at line 135 of file smartptraids.hpp.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).