rcolyer.net
RC Lib  Version 202403231100
Classes | Namespaces | Macros | Functions
RCBits.h File Reference

Provides short convenience classes and functions. More...

#include "RCconfig.h"
#include "Errors.h"
#include "Tuple.h"
#include "Types.h"
#include <iostream>
#include <sstream>
#include <string>

Go to the source code of this file.

Classes

class  RC::LoopIndex
 A size_t like integer class which automatically stays within its range. More...
 
class  RC::HoldRelated< Hold, Provide >
 Stores the value of type Hold while providing access via type Provide. More...
 
class  RC::DebugTrack< ClassTracking, stack_trace >
 Inherit this class to add construction, destruction, and assignment output tracking. More...
 
class  RC::DynamicLibrary
 Opens a dynamic library filename and stores a handle to it. Use as second parameter for RC_DYNAMIC_LOAD_FUNC(FuncName,DynLib) More...
 

Namespaces

 RC
 

Macros

#define RC_DYNAMIC_LOAD_FUNC(FuncName, DynLib)    static RC::DynamicFunction<decltype(FuncName)> FuncName{DynLib, #FuncName};
 Use as RC_DYNAMIC_LOAD_FUNC(FuncName,DynLib) to load FuncName from the dynamic library file opened by a constructor of the DynamicLibrary class. More...
 

Functions

template<class T >
BetwCompare< T > RC::Betw (const T &x)
 Returns a comparator that can be used for range comparisons. More...
 
template<class... Args>
OneOfCompare< Args... > RC::OneOf (Args... args)
 Returns a comparator that can be used to check if something is in a list. More...
 
template<class T >
RangeHelper< T > RC::Range (const T &start, const T &past_the_end)
 Provides an iterator which dereferences to the iterated values [start,past_the_end). More...
 
template<class T2 >
auto RC::IndexOf (const T2 &cont) -> RangeHelper< decltype(cont.size())>
 Provides an iterator which dereferences to the indices of cont from [0,cont.size()). More...
 
template<class T , class T2 >
RC::CheckedCast (const T2 &x)
 For integer and floating point types, Throws RC::ErrorMsgBounds if the value of x does not fit into T. Use as CheckedCast<T>(x)
 
template<class T , class T2 >
RC::CappedCast (const T2 &x)
 For integer and floating point types, caps the cast value of x to be within bounds of type T. Use as CappedCast<T>(x)
 

Detailed Description

Provides short convenience classes and functions.

Macro Definition Documentation

◆ RC_DYNAMIC_LOAD_FUNC

#define RC_DYNAMIC_LOAD_FUNC (   FuncName,
  DynLib 
)     static RC::DynamicFunction<decltype(FuncName)> FuncName{DynLib, #FuncName};

Use as RC_DYNAMIC_LOAD_FUNC(FuncName,DynLib) to load FuncName from the dynamic library file opened by a constructor of the DynamicLibrary class.

This creates a static function object named FuncName in-place to provide access to the loaded library. As it overrides FuncName, the previous declaration of FuncName MUST be in an outer scope (outside of the function where this is called). For example, include the original definition from a header, and use this inside of a function or namespace. After this macro, call FuncName with the same syntax as you would the previously declared FuncName. This macro uses classes defined for both Linux and Windows. ErrorMsgFile is thrown in the event of a loading error.

email address
— (c) 2015