Lumiera  0.pre.03
»edit your freedom«
size-trait.hpp File Reference

Go to the source code of this file.

Description

Metaprogramming definitions to deal with dependency on implementation size and layout.

Sometimes we need to build our code based on very specific assumptions regarding the implementation data layout of library classes we rely on. Typically such happens when we're forced to work around limitations the library provider never intended to be relevant for any client. Which places us into the very unfortunate situation either to abandon some design concept we prefer to use for some other relevant reason, or to do something very evil and nasty (namely to rely on magic numbers, which may break silently when the library provider changes implementation).

While this situation can not be solved in principle, at least we may concentrate all these nasty dependencies in a single location. Moreover, we can deal with this situation by constructing our magic numbers at least in a systematic way, which allows us to intersperse static assertions to trigger an alarm when adjustments need to be made.

typical example
A prominent example is boost::format, which causes a lot of code size bloat when used liberally. For that reason, we built a front-end to encapsulate the boost implementation, so any typed flavour of any call needs to be instantiated only once per application. This allows us to use type safe formatting in error messages, but unfortunately forces us to rely on the precise size of the boost::format implementation.

Definition in file size-trait.hpp.

#include <vector>
#include <string>

Classes

struct  SizeTrait::BasicAltstringbuf
 
struct  SizeTrait::BasicStringbuf
 
struct  SizeTrait::BoostFormat
 
struct  SizeTrait::CompatAllocator
 
struct  SizeTrait::Locale
 
struct  SizeTrait::Optional< T >
 
class  SizeTrait
 A collection of constants to describe the expected size of some known classes, without needing to include the respective headers. More...
 

Namespaces

 lib
 Implementation namespace for support and library code.
 

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 >: