Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
variant-wrapper.hh File Reference
#include <variant>

Go to the source code of this file.

Macros

#define FORCE_DEFAULT_MOVE_CONSTRUCTORS(CLASS_NAME)
#define FORCE_DEFAULT_CONSTRUCTORS(CLASS_NAME)
#define MAKE_WRAPPER_CONSTRUCTOR_RAW(CLASS_NAME)
#define MAKE_WRAPPER_CONSTRUCTOR_MOVE_ONLY(CLASS_NAME)
#define MAKE_WRAPPER_CONSTRUCTOR(CLASS_NAME)

Macro Definition Documentation

◆ FORCE_DEFAULT_CONSTRUCTORS

#define FORCE_DEFAULT_CONSTRUCTORS ( CLASS_NAME)
Value:
FORCE_DEFAULT_MOVE_CONSTRUCTORS(CLASS_NAME) \
\
CLASS_NAME(const CLASS_NAME &) = default; \
\
CLASS_NAME & operator=(const CLASS_NAME &) = default;

Force the default versions of all constructors (copy, move, copy assignment).

◆ FORCE_DEFAULT_MOVE_CONSTRUCTORS

#define FORCE_DEFAULT_MOVE_CONSTRUCTORS ( CLASS_NAME)
Value:
CLASS_NAME(CLASS_NAME &&) = default; \
CLASS_NAME & operator=(CLASS_NAME &&) = default;

◆ MAKE_WRAPPER_CONSTRUCTOR

#define MAKE_WRAPPER_CONSTRUCTOR ( CLASS_NAME)
Value:
MAKE_WRAPPER_CONSTRUCTOR_RAW(CLASS_NAME)
#define FORCE_DEFAULT_CONSTRUCTORS(CLASS_NAME)
Definition variant-wrapper.hh:15

Like MAKE_WRAPPER_CONSTRUCTOR, but also explicitly defaults copy operations for copyable types.

◆ MAKE_WRAPPER_CONSTRUCTOR_MOVE_ONLY

#define MAKE_WRAPPER_CONSTRUCTOR_MOVE_ONLY ( CLASS_NAME)
Value:
FORCE_DEFAULT_MOVE_CONSTRUCTORS(CLASS_NAME) \
MAKE_WRAPPER_CONSTRUCTOR_RAW(CLASS_NAME)

Make a wrapper constructor. Also defaults move constructor/assignment. Copy operations will be implicitly defaulted or deleted based on the Raw type.

◆ MAKE_WRAPPER_CONSTRUCTOR_RAW

#define MAKE_WRAPPER_CONSTRUCTOR_RAW ( CLASS_NAME)
Value:
template<typename... Args> \
requires(!(sizeof...(Args) == 1 && (std::is_same_v<std::remove_cvref_t<Args>, CLASS_NAME> && ...))) \
CLASS_NAME(Args &&... arg) \
: raw(std::forward<Args>(arg)...) \
{ \
}

Forwarding constructor for wrapper types. All args are forwarded to the construction of the "raw" field.

The moral equivalent of using Raw::Raw;