4#include "MRPch/MRBindingMacros.h"
7#ifndef MR_USE_STD_EXPECTED
8#if __cpp_lib_expected >= 202211
9#define MR_USE_STD_EXPECTED 1
11#define MR_USE_STD_EXPECTED 0
15#if MR_USE_STD_EXPECTED
18#include <tl/expected.hpp>
21#ifdef MR_DOT_NET_BUILD
24template<
typename T,
typename E>
25class expected :
public tl::expected<T, E>
27 using tl::expected<T, E>::expected;
31inline auto unexpected( E &&e )
33 return tl::make_unexpected( std::forward<E>( e ) );
44#if MR_USE_STD_EXPECTED || defined(MR_DOT_NET_BUILD)
46template<
class T,
class E = std::
string>
52 return std::unexpected( std::forward<E>( e ) );
57template<
class T,
class E = std::
string>
63 return tl::make_unexpected( std::forward<E>( e ) );
71 return "Operation was canceled";
83 return "Unsupported file extension";
MR_BIND_IGNORE std::string stringUnsupportedFileExtension()
common message about unknown file extension
Definition MRExpected.h:81
MR_BIND_IGNORE auto unexpected(E &&e)
Definition MRExpected.h:61
tl::expected< T, E > Expected
Definition MRExpected.h:58
MR_BIND_IGNORE auto unexpectedUnsupportedFileExtension()
returns Expected error with stringUnsupportedFileExtension()
Definition MRExpected.h:87
MR_BIND_IGNORE auto unexpectedOperationCanceled()
returns Expected error with stringOperationCanceled()
Definition MRExpected.h:75
MR_BIND_IGNORE std::string stringOperationCanceled()
common message about user termination of an operation
Definition MRExpected.h:69