Spatial C++ Library
Generic Multi-Dimensional Containers and Spatial Operations
spatial::details::Compress< Base, Member > Struct Template Reference

Uses the empty base class optimization in order to compress a potentially empty base class with a member of a class. More...

#include <spatial_compress.hpp>

Inherits Base.

Public Member Functions

 Compress ()
 Uninitialized compressed base. More...
 
 Compress (const Base &compressed_base)
 Compressed member with uninitialized base. More...
 
 Compress (const Base &compressed_base, const Member &member)
 Standard initializer with Base and Member values. More...
 
const Base & base () const
 Accessor to the base class. More...
 
Base & base ()
 Accessor to the base class. More...
 
const Member & operator() () const
 Quick accessor to the member. More...
 
Member & operator() ()
 Quick accessor to the member. More...
 

Private Attributes

Member _member
 Storage for the member value. More...
 

Detailed Description

template<typename Base, typename Member>
struct spatial::details::Compress< Base, Member >

Uses the empty base class optimization in order to compress a potentially empty base class with a member of a class.

Provide the base() function to access the base class. Provide the operator() to quickly access the stored member.

Template Parameters
BaseThe base class that will be compressed through empty member optimization by the compiler, hopefully.
MemberThe member class that will be used as a value for the compression, this class should not be an empty member class.

Definition at line 46 of file spatial_compress.hpp.

Constructor & Destructor Documentation

template<typename Base, typename Member>
spatial::details::Compress< Base, Member >::Compress ( )

Uninitialized compressed base.

Definition at line 50 of file spatial_compress.hpp.

template<typename Base, typename Member>
spatial::details::Compress< Base, Member >::Compress ( const Base &  compressed_base)
explicit

Compressed member with uninitialized base.

Parameters
compressed_baseThe value of the Base type.

Definition at line 54 of file spatial_compress.hpp.

template<typename Base, typename Member>
spatial::details::Compress< Base, Member >::Compress ( const Base &  compressed_base,
const Member &  member 
)

Standard initializer with Base and Member values.

Parameters
compressed_baseThe value of the Base type.
memberThe value of the Member type.

Definition at line 60 of file spatial_compress.hpp.

Member Function Documentation

template<typename Base, typename Member>
const Base& spatial::details::Compress< Base, Member >::base ( ) const

Accessor to the base class.

Definition at line 68 of file spatial_compress.hpp.

template<typename Base, typename Member>
Base& spatial::details::Compress< Base, Member >::base ( )

Accessor to the base class.

Definition at line 72 of file spatial_compress.hpp.

template<typename Base, typename Member>
const Member& spatial::details::Compress< Base, Member >::operator() ( ) const

Quick accessor to the member.

Definition at line 81 of file spatial_compress.hpp.

template<typename Base, typename Member>
Member& spatial::details::Compress< Base, Member >::operator() ( )

Quick accessor to the member.

Definition at line 85 of file spatial_compress.hpp.

Member Data Documentation

template<typename Base, typename Member>
Member spatial::details::Compress< Base, Member >::_member
private

Storage for the member value.

Definition at line 91 of file spatial_compress.hpp.


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