NCBI C++ ToolKit
Public Types | Public Member Functions | Private Attributes | List of all members
pair_base_member< Base, Member > Class Template Reference

Search Toolkit Book for pair_base_member

Template used for empty base class optimization. More...

#include <corelib/ncbimisc.hpp>

+ Inheritance diagram for pair_base_member< Base, Member >:
+ Collaboration diagram for pair_base_member< Base, Member >:

Public Types

typedef Base base_type
 
typedef Base first_type
 
typedef Member member_type
 
typedef Member second_type
 

Public Member Functions

 pair_base_member (void)
 
 pair_base_member (const member_type &member_value)
 
 pair_base_member (const first_type &first_value, const second_type &second_value)
 
const first_typefirst () const
 
first_typefirst ()
 
const second_typesecond () const
 
second_typesecond ()
 
void Swap (pair_base_member< first_type, second_type > &p)
 

Private Attributes

member_type m_Member
 

Detailed Description

template<class Base, class Member>
class pair_base_member< Base, Member >

Template used for empty base class optimization.

See details in the August '97 "C++ Issue" of Dr. Dobb's Journal Also available from http://www.cantrip.org/emptyopt.html We store usually empty template argument class together with data member. This template is much like STL's pair<>, but the access to members is done though methods first() and second() returning references to corresponding members. First template argument is represented as private base class, while second template argument is represented as private member. In addition to constructor taking two arguments, we add constructor for initialization of only data member (second). This is useful since usually first type is empty and doesn't require non-trivial constructor. We do not define any comparison functions as this template is intented to be used internally within another templates, which themselves should provide any additional functionality.

Examples
/home/coremake/doxygen/cxx/include/corelib/ncbimisc.hpp.

Definition at line 245 of file ncbimisc.hpp.


The documentation for this class was generated from the following file:
Modified on Fri Sep 20 14:58:05 2024 by modify_doxy.py rev. 669887