Lumiera  0.pre.03
»edit your freedom«
SizeTrait Class Reference

#include "lib/meta/size-trait.hpp"

Description

A collection of constants to describe the expected size of some known classes, without needing to include the respective headers.

This is an optimisation to improve compilation times and/or reduce size of the generated object files in debug mode. To get those sizes computed in a fairly portable way, but without much overhead, we mimic the memory layout of "the real thing" with some reasonable simplifications:

  • the size of vectors doesn't really depend on the elements
  • our strings, streams and buffers use just simple chars
Interface
The purpose of this whole construction is to pull off some constants based on sizeof expressions:
  • the size of a string
  • the size of a vector
  • the size of a boost::format
Warning
this setup is quite fragile and directly relies on the implementation layout of the GNU STL and Boost. Whenever using this stuff, make sure to place an assertion somewhere down in the implementation level to check against the size of the real thing.

Definition at line 86 of file size-trait.hpp.

Public Types

enum  {
  ALIGNMENT = sizeof(size_t),
  STRING = sizeof(std::string),
  VECTOR = sizeof(Vector),
  BVECTOR = sizeof(BVector),
  BOOST_FORMAT = sizeof(BoostFormat)
}
 

Classes

struct  BasicAltstringbuf
 
struct  BasicStringbuf
 
struct  BoostFormat
 
struct  CompatAllocator
 
struct  Locale
 
struct  Optional
 

Private Types

typedef std::vector< bool > BVector
 
enum  IOS_Openmode {
  _S_app = 1L << 0,
  _S_ate = 1L << 1,
  _S_bin = 1L << 2,
  _S_in = 1L << 3,
  _S_out = 1L << 4,
  _S_trunc = 1L << 5,
  _S_ios_openmode_end = 1L << 16
}
 
typedef std::vector< size_t > Vector
 

Class Documentation

◆ lib::meta::SizeTrait::BoostFormat

struct lib::meta::SizeTrait::BoostFormat
Class Members
Vector items_
BVector bound_
int style_
int cur_arg_
int num_args_
bool dumped_
string prefix_
unsigned char exceptions
BasicAltstringbuf buf_
Optional< Locale > loc_
+ Collaboration diagram for SizeTrait::BoostFormat:

◆ lib::meta::SizeTrait::Locale

struct lib::meta::SizeTrait::Locale
Class Members
void * _M_impl
+ Collaboration diagram for SizeTrait::Locale:

◆ lib::meta::SizeTrait::Optional

struct lib::meta::SizeTrait::Optional
Class Members
bool m_initialized_
T m_storage_
+ Inheritance diagram for SizeTrait::Optional< T >:
+ Collaboration diagram for SizeTrait::Optional< T >:
+ Collaboration diagram for SizeTrait:

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