Lumiera  0.pre.03
»edit your freedom«
wrapper.hpp File Reference

Go to the source code of this file.

Description

Library implementation: smart-pointer variations, wrappers and managing holders.

This is (intended to become) a loose collection of the various small helper templates for wrapping, containing, placing or handling a somewhat problematic other object. Mostly these are implemented to suit a specific need and then factored out later on.

  • ItemWrapper is a similar concept, but more like a smart-ptr. Moreover, it can be instantiated with a value type, a pointer or a reference type, yielding the same behaviour in all cases (useful for building templates)
  • FunctionResult is the combination of ItemWrapper with a functor object to cache the function result value.
See also
lib::TransformIter
Todo:
2017 consider to split off the FunctionResult into a dedicated header to reduce includes

Definition in file wrapper.hpp.

#include "lib/error.hpp"
#include "lib/nocopy.hpp"
#include "lib/meta/function.hpp"
#include "lib/meta/function-closure.hpp"
#include "lib/meta/util.hpp"
#include "lib/util.hpp"
#include <functional>
#include <cstddef>

Classes

struct  FunctionResult< SIG >
 Extension of ItemWrapper: a function remembering the result of the last invocation. More...
 
class  ItemWrapper< TY >
 Universal value/ref wrapper accessible similar to a pointer. More...
 
class  ItemWrapper< TY & >
 Specialisation of the ItemWrapper to deal with references, as if they were pointer values. More...
 
class  ItemWrapper< void >
 Fallback-specialisation for ItemWrapper<void>. More...
 
class  ReturnRef< T >
 Reference wrapper implemented as constant function, returning the (fixed) reference on invocation. More...
 

Functions

template<typename TY >
bool operator!= (ItemWrapper< TY > const &w1, ItemWrapper< TY > const &w2)
 
template<typename TY >
bool operator== (ItemWrapper< TY > const &w1, ItemWrapper< TY > const &w2)
 allow equality comparison if the wrapped types are comparable
 
template<typename T >
ReturnRef< T > refFunction (T &target)
 

Namespaces

 lib
 Implementation namespace for support and library code.