CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
default.h
1
3#ifndef _aspose_system_default_h_
4#define _aspose_system_default_h_
5
6#include "system/boxable_traits.h"
7#include "system/shared_ptr.h"
8#include "system/object.h"
9#include <type_traits>
10
11namespace System {
12
15template<typename T>
16typename std::enable_if<IsExceptionWrapper<T>::value, const T&>::type Default()
17{
18 static T value = T(nullptr);
19 return value;
20}
21
24template <typename T>
25typename std::enable_if<!IsExceptionWrapper<T>::value, const T&>::type Default()
26{
27 static T value = T();
28 return value;
29}
30
31namespace Details {
33template <typename T>
34T DefaultValue()
35{
36 return System::Default<T>();
37}
38} // Details
39
42template <typename T>
43T& Discard(T&& initial = Details::DefaultValue<T>())
44{
45 return std::forward<T&>(initial);
46}
47
48}
49#endif
Definition: db_command.h:9
T & Discard(T &&initial=Details::DefaultValue< T >())
Returns the default-constructed temporary instance of the specified type, which can be placed instead...
Definition: default.h:43
std::enable_if< IsExceptionWrapper< T >::value, constT & >::type Default()
Returns the reference to the single default-constructed instance of the exception type.
Definition: default.h:16