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
33template <typename T>
34auto Discard()
35{
36 struct Impl
37 {
38 operator T&()
39 {
40 return value;
41 }
42
43 T value = Default<T>();
44 };
45
46 return Impl();
47}
48
49}
50#endif
Definition: db_command.h:9
auto Discard()
Returns the default-constructed temporary instance of the specified type, which can be placed instead...
Definition: default.h:34
std::enable_if< IsExceptionWrapper< T >::value, constT & >::type Default()
Returns the default-constructed instance of the specified type.
Definition: default.h:16