cheshirekow  v0.1.0
kwargs.h File Reference

tooling for python-like kwargs in c++ More...

#include <cstdint>

Go to the source code of this file.

Classes

struct  kw::Arg< Tag, T >
 parameter storage for type T within a parameter pack More...
 
struct  kw::ConstRefWrap< T >
 signifies the parameter should be passed by const reference More...
 
struct  kw::ContainsTag< Tag, Args >
 template meta-function contains a static boolean variable 'result' which is true if Tag is in the list of kwargs and false if not More...
 
struct  kw::ContainsTag< Tag >
 specialization for when Tag is not in the type list More...
 
struct  kw::ContainsTag< Tag, Arg< Tag, T >, Rest...>
 specialization for when the Arg<Tag,T> type is found More...
 
struct  kw::ContainsTag< Tag, First, Rest...>
 specialization for recursion More...
 
struct  kw::GetImpl< Tag, exists, Default, Args >
 provides static member Get() with implementations depending on whether or not Tag is in Args... More...
 
struct  kw::GetImpl< Tag, false, Default, Args...>
 specialization for when Tag is not in Args..., returns the default value More...
 
struct  kw::GetImpl< Tag, true, Default, Args...>
 specialization for when Tag is in Args... returns the value corresponding to Tag More...
 
struct  kw::Key< Tag >
 assignment operator sentinal used as a key for key-values pairs in the kwargs parameter pack More...
 
struct  kw::ParamPack< Args >
 storage for kwargs parameter pack More...
 
struct  kw::ParamPack< Args >
 storage for kwargs parameter pack More...
 
struct  kw::ParamPack< Head, Tail...>
 specialization for recursion, provides storage for the current type in the type list, then recursively derives from the remaining types in the type list More...
 
struct  kw::ParamPack< Tail >
 specialization for base case, provides storage for the last type in the type list More...
 
struct  kw::RefWrap< T >
 signifies that the parameter should be passed by reference More...
 
class  kw::Tag
 constexpr string, used to implement tagging with strings More...
 
struct  kw::TypeOfTagDefault< Tag, Default, Args >
 template meta function provides a member typedef Result which evaluates to T if Arg<Tag,T> is in Args... or Default if it is not More...
 
struct  kw::TypeOfTagDefault< Tag, Default >
 specialization for when Arg<Tag,T> is not in the type list More...
 
struct  kw::TypeOfTagDefault< Tag, Default, Arg< Tag, T >, Tail...>
 specialization for when Arg<Tag,T> is found More...
 
struct  kw::TypeOfTagDefault< Tag, Default, Head, Tail...>
 specialization for recursion More...
 

Namespaces

 kw
 classes and templates used by kwargs library
 

Macros

#define KW(key)   kw::Key<kw::Hash(#key)>()
 
#define TAG(key)   kw::Hash(#key)
 

Functions

template<typename T >
const ConstRefWrap< T > kw::ConstRef (const T &v)
 forces an argument to be passed by const reference More...
 
constexpr bool kw::ContainsTagFn (uint64_t tag)
 Function version of ContainsTag. More...
 
template<uint64_t Tag, typename T , typename... Rest>
constexpr bool kw::ContainsTagFn (uint64_t tag, Arg< Tag, T > first, Rest...rest)
 
template<uint64_t Tag, typename Default , typename... Args>
TypeOfTagDefault< Tag, Default,
Args...>::Result 
kw::Get (ParamPack< Args...> &pack, Default d)
 given a parameter pack, retrieves and return sthe parameter tagged with tag, or else returns a default value if tag is not in Args... More...
 
template<uint64_t Tag, typename Default , typename... Args>
TypeOfTagDefault< Tag, Default,
Args...>::Result 
kw::Get (ParamPack< Args...> &pack, const Key< Tag > &key, Default d)
 given a parameter pack, retrieves and return sthe parameter tagged with tag, or else returns a default value if tag is not in Args... More...
 
template<uint32_t N>
constexpr uint64_t kw::Hash (const char(&string)[N])
 returns a 64bit hash of string More...
 
uint64_t kw::HashString (const std::string &str, int i, uint64_t hash)
 Return an unsigned 64bit hash of string. More...
 
uint64_t kw::HashString (const std::string &str)
 
template<typename T >
RefWrap< T > kw::Ref (T &v)
 forces an argument to be passed by reference More...
 
template<typename T , typename ReturnType >
ReturnType kw::SafeReturn (T query, ReturnType default_value)
 SFINAE to safely iterate over params in a parampack since we cannot use the ?: operator on any old pairs of types. More...
 

Detailed Description

tooling for python-like kwargs in c++

Author
Josh Bialkowski josh..nosp@m.bial.nosp@m.kowsk.nosp@m.i@gm.nosp@m.ail.c.nosp@m.om

Definition in file kwargs.h.

Macro Definition Documentation

#define KW (   key)    kw::Key<kw::Hash(#key)>()

Definition at line 363 of file kwargs.h.

#define TAG (   key)    kw::Hash(#key)

Definition at line 362 of file kwargs.h.