Template Class With#

Class Documentation#

template<typename ContextType>
class With#

RAII wrapper function to enter and exit a context object similar to python’s with syntax.

// context class
class MyContext {
 private:
friend class With<MyContext>;
   MyContext(arguments);
void EnterWithScope();
void ExitWithScope();
};

{
With<MyContext> scope(arguments);
// effect take place.
}
Template Parameters:

ContextType – Type of the context object.

Public Functions

template<typename ...Args>
inline explicit With(Args&&... args)#

constructor. Enter the scope of the context.

inline ~With()#

destructor, leaves the scope of the context.

With(const With &other) = delete#
With &operator=(const With &other) = delete#
With(With &&other) = delete#
With &operator=(With &&other) = delete#
inline ContextType *get()#
inline const ContextType *get() const#
inline ContextType *operator->()#
inline const ContextType *operator->() const#
inline ContextType &operator*()#
inline const ContextType &operator*() const#
inline ContextType operator()()#