|
MGIS
|
This header declares utility functions to build objects handling any exception thrown by a constructor. More...
#include <memory>#include <optional>#include <type_traits>#include "MGIS/Context.hxx"#include "MGIS/InvalidResult.hxx"#include "MGIS/Utilities/Construct.ixx"Namespaces | |
| namespace | mgis |
the namespace mgis encloses all the MGIS project. | |
Macros | |
| #define | MGIS_CONSTRUCT(Type, e, ...) ::mgis::construct<Type>(e, __VA_ARGS__) |
a simple wrapper around the construct function which handles the declaration of the source location if needed | |
| #define | MGIS_MAKE_UNIQUE(Type, e, ...) ::mgis::make_unique<Type>(e, __VA_ARGS__) |
a simple wrapper around the make_unique function which handles the declaration of the source location if needed. | |
| #define | MGIS_MAKE_UNIQUE_AS(BaseType, Type, e, ...) ::mgis::make_unique_as<BaseType, Type>(e, __VA_ARGS__) |
a simple wrapper around the make_unique_as function which handles the declaration of the source location if needed | |
| #define | MGIS_MAKE_SHARED_AS(BaseType, Type, e, ...) ::mgis::make_shared_as<BaseType, Type>(e, __VA_ARGS__) |
a simple wrapper around the make_shared_as function which handles the declaration of the source location if needed. | |
| #define | MGIS_MAKE_SHARED(Type, e, ...) ::mgis::make_shared<Type>(e, __VA_ARGS__) |
a simple wrapper around the make_shared function which handles the declaration of the source location if needed | |
| #define | MGIS_TRY_CONSTRUCT(Type, v, e, ...) |
| an helper macro to build a variable the constructor of which may throw | |
| #define | MGIS_TRY_MAKE_UNIQUE(Type, v, e, ...) |
| an helper macro to build an unique pointer for type the constructor of which may throw | |
| #define | MGIS_TRY_MAKE_UNIQUE_AS(BaseType, Type, v, e, ...) |
| an helper macro to build an unique pointer for type the constructor of which may throw | |
| #define | MGIS_TRY_MAKE_SHARED(Type, v, e, ...) |
| an helper macro to build an shared pointer for type the constructor of which may throw | |
| #define | MGIS_TRY_MAKE_SHARED_AS(BaseType, Type, v, e, ...) |
| an helper macro to build an shared pointer for type the constructor of which may throw | |
Functions | |
| template<typename Type , typename... ArgumentsTypes> requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...> | |
| std::optional< Type > | mgis::construct (Context &, ArgumentsTypes &&...) noexcept |
| try to build an object of the given type. | |
| template<typename Type , typename... ArgumentsTypes> requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...> | |
| std::unique_ptr< Type > | mgis::make_unique (Context &, ArgumentsTypes &&...) noexcept |
| try to build a unique pointer holding the given type. | |
| template<typename BaseType , typename Type , typename... ArgumentsTypes> requires std::is_base_of_v<BaseType, Type> && ::mgis::internals::is_constructible<Type, ArgumentsTypes...> | |
| std::unique_ptr< BaseType > | mgis::make_unique_as (Context &, ArgumentsTypes &&...) noexcept |
| try to build a unique pointer of a base type holding the given type. | |
| template<typename Type , typename... ArgumentsTypes> requires ::mgis::internals::is_constructible<Type, ArgumentsTypes...> | |
| std::shared_ptr< Type > | mgis::make_shared (Context &, ArgumentsTypes &&...) noexcept |
| try to build a shared pointer holding the given type. | |
| template<typename BaseType , typename Type , typename... ArgumentsTypes> requires std::is_base_of_v<BaseType, Type> && ::mgis::internals::is_constructible<Type, ArgumentsTypes...> | |
| std::shared_ptr< BaseType > | mgis::make_shared_as (Context &, ArgumentsTypes &&...) noexcept |
| try to build a shared pointer of a base type holding the given type. | |
Variables | |
| template<typename Type , typename... ArgumentsTypes> | |
| constexpr auto | mgis::internals::is_constructible_without_context |
| template<typename Type , typename... ArgumentsTypes> | |
| constexpr auto | mgis::internals::is_constructible_with_context |
| template<typename Type , typename... ArgumentsTypes> | |
| constexpr auto | mgis::internals::is_constructible |
This header declares utility functions to build objects handling any exception thrown by a constructor.
| #define MGIS_CONSTRUCT | ( | Type, | |
| e, | |||
| ... | |||
| ) | ::mgis::construct<Type>(e, __VA_ARGS__) |
a simple wrapper around the construct function which handles the declaration of the source location if needed
| [in] | Type | type of the object built |
| [in,out] | ctx | execution context |
| #define MGIS_MAKE_SHARED | ( | Type, | |
| e, | |||
| ... | |||
| ) | ::mgis::make_shared<Type>(e, __VA_ARGS__) |
a simple wrapper around the make_shared function which handles the declaration of the source location if needed
| [in] | Type | type of the object built |
| [in,out] | ctx | execution context |
| #define MGIS_MAKE_SHARED_AS | ( | BaseType, | |
| Type, | |||
| e, | |||
| ... | |||
| ) | ::mgis::make_shared_as<BaseType, Type>(e, __VA_ARGS__) |
a simple wrapper around the make_shared_as function which handles the declaration of the source location if needed.
| [in] | Type | type of the object built |
| [in,out] | ctx | execution context |
| #define MGIS_MAKE_UNIQUE | ( | Type, | |
| e, | |||
| ... | |||
| ) | ::mgis::make_unique<Type>(e, __VA_ARGS__) |
a simple wrapper around the make_unique function which handles the declaration of the source location if needed.
| [in] | Type | type of the object built |
| [in,out] | ctx | execution context |
| #define MGIS_MAKE_UNIQUE_AS | ( | BaseType, | |
| Type, | |||
| e, | |||
| ... | |||
| ) | ::mgis::make_unique_as<BaseType, Type>(e, __VA_ARGS__) |
a simple wrapper around the make_unique_as function which handles the declaration of the source location if needed
| [in] | Type | type of the object built |
| [in,out] | ctx | execution context |
| #define MGIS_TRY_CONSTRUCT | ( | Type, | |
| v, | |||
| e, | |||
| ... | |||
| ) |
an helper macro to build a variable the constructor of which may throw
| [in] | Type | type of the object built |
| [in] | v | name of the variable built |
| [in,out] | ctx | execution context |
| #define MGIS_TRY_MAKE_SHARED | ( | Type, | |
| v, | |||
| e, | |||
| ... | |||
| ) |
an helper macro to build an shared pointer for type the constructor of which may throw
| [in] | Type | type of the object built |
| [in] | v | name of the variable built |
| [in,out] | ctx | execution context |
| #define MGIS_TRY_MAKE_SHARED_AS | ( | BaseType, | |
| Type, | |||
| v, | |||
| e, | |||
| ... | |||
| ) |
an helper macro to build an shared pointer for type the constructor of which may throw
| [in] | BaseType | pointer to a base type |
| [in] | Type | type of the object built |
| [in] | v | name of the variable built |
| [in,out] | ctx | execution context |
| #define MGIS_TRY_MAKE_UNIQUE | ( | Type, | |
| v, | |||
| e, | |||
| ... | |||
| ) |
an helper macro to build an unique pointer for type the constructor of which may throw
| [in] | Type | type of the object built |
| [in] | v | name of the variable built |
| [in,out] | ctx | execution context |
| #define MGIS_TRY_MAKE_UNIQUE_AS | ( | BaseType, | |
| Type, | |||
| v, | |||
| e, | |||
| ... | |||
| ) |
an helper macro to build an unique pointer for type the constructor of which may throw
| [in] | BaseType | pointer to a base type |
| [in] | Type | type of the object built |
| [in] | v | name of the variable built |
| [in,out] | ctx | execution context |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |