| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,41 +7,6 @@ | |||
| 7 | 7 | #ifndef {{"_".join(config.protocol.namespace)}}_Maybe_h | |
| 8 | 8 | #define {{"_".join(config.protocol.namespace)}}_Maybe_h | |
| 9 | 9 | ||
| 10 | - // This macro allows to test for the version of the GNU C++ compiler. | ||
| 11 | - // Note that this also applies to compilers that masquerade as GCC, | ||
| 12 | - // for example clang and the Intel C++ compiler for Linux. | ||
| 13 | - // Use like: | ||
| 14 | - // #if IP_GNUC_PREREQ(4, 3, 1) | ||
| 15 | - // ... | ||
| 16 | - // #endif | ||
| 17 | - #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) | ||
| 18 | - #define IP_GNUC_PREREQ(major, minor, patchlevel) \ | ||
| 19 | - ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \ | ||
| 20 | - ((major)*10000 + (minor)*100 + (patchlevel))) | ||
| 21 | - #elif defined(__GNUC__) && defined(__GNUC_MINOR__) | ||
| 22 | - #define IP_GNUC_PREREQ(major, minor, patchlevel) \ | ||
| 23 | - ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= \ | ||
| 24 | - ((major)*10000 + (minor)*100 + (patchlevel))) | ||
| 25 | - #else | ||
| 26 | - #define IP_GNUC_PREREQ(major, minor, patchlevel) 0 | ||
| 27 | - #endif | ||
| 28 | - | ||
| 29 | - #if defined(__mips64) | ||
| 30 | - #define IP_TARGET_ARCH_MIPS64 1 | ||
| 31 | - #elif defined(__MIPSEB__) || defined(__MIPSEL__) | ||
| 32 | - #define IP_TARGET_ARCH_MIPS 1 | ||
| 33 | - #endif | ||
| 34 | - | ||
| 35 | - // Allowing the use of noexcept by removing the keyword on older compilers that | ||
| 36 | - // do not support adding noexcept to default members. | ||
| 37 | - #if ((IP_GNUC_PREREQ(4, 9, 0) && !defined(IP_TARGET_ARCH_MIPS) && \ | ||
| 38 | - !defined(IP_TARGET_ARCH_MIPS64)) || \ | ||
| 39 | - (defined(__clang__) && __cplusplus > 201300L)) | ||
| 40 | - #define IP_NOEXCEPT noexcept | ||
| 41 | - #else | ||
| 42 | - #define IP_NOEXCEPT | ||
| 43 | - #endif | ||
| 44 | - | ||
| 45 | 10 | //#include "Forward.h" | |
| 46 | 11 | ||
| 47 | 12 | {% for namespace in config.protocol.namespace %} | |
@@ -53,7 +18,7 @@ class Maybe { | |||
| 53 | 18 | public: | |
| 54 | 19 | Maybe() : m_value() { } | |
| 55 | 20 | Maybe(std::unique_ptr<T> value) : m_value(std::move(value)) { } | |
| 56 | - Maybe(Maybe&& other) IP_NOEXCEPT : m_value(std::move(other.m_value)) {} | ||
| 21 | + Maybe(Maybe&& other) noexcept : m_value(std::move(other.m_value)) {} | ||
| 57 | 22 | void operator=(std::unique_ptr<T> value) { m_value = std::move(value); } | |
| 58 | 23 | T* fromJust() const { DCHECK(m_value); return m_value.get(); } | |
| 59 | 24 | T* fromMaybe(T* defaultValue) const { return m_value ? m_value.get() : defaultValue; } | |
@@ -68,7 +33,7 @@ class MaybeBase { | |||
| 68 | 33 | public: | |
| 69 | 34 | MaybeBase() : m_isJust(false) { } | |
| 70 | 35 | MaybeBase(T value) : m_isJust(true), m_value(value) { } | |
| 71 | - MaybeBase(MaybeBase&& other) IP_NOEXCEPT | ||
| 36 | + MaybeBase(MaybeBase&& other) noexcept | ||
| 72 | 37 | : m_isJust(other.m_isJust), | |
| 73 | 38 | m_value(std::move(other.m_value)) {} | |
| 74 | 39 | void operator=(T value) { m_value = value; m_isJust = true; } | |
@@ -87,7 +52,7 @@ class Maybe<bool> : public MaybeBase<bool> { | |||
| 87 | 52 | public: | |
| 88 | 53 | Maybe() { m_value = false; } | |
| 89 | 54 | Maybe(bool value) : MaybeBase(value) { } | |
| 90 | - Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {} | ||
| 55 | + Maybe(Maybe&& other) noexcept : MaybeBase(std::move(other)) {} | ||
| 91 | 56 | using MaybeBase::operator=; | |
| 92 | 57 | }; | |
| 93 | 58 | ||
@@ -96,7 +61,7 @@ class Maybe<int> : public MaybeBase<int> { | |||
| 96 | 61 | public: | |
| 97 | 62 | Maybe() { m_value = 0; } | |
| 98 | 63 | Maybe(int value) : MaybeBase(value) { } | |
| 99 | - Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {} | ||
| 64 | + Maybe(Maybe&& other) noexcept : MaybeBase(std::move(other)) {} | ||
| 100 | 65 | using MaybeBase::operator=; | |
| 101 | 66 | }; | |
| 102 | 67 | ||
@@ -105,7 +70,7 @@ class Maybe<double> : public MaybeBase<double> { | |||
| 105 | 70 | public: | |
| 106 | 71 | Maybe() { m_value = 0; } | |
| 107 | 72 | Maybe(double value) : MaybeBase(value) { } | |
| 108 | - Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {} | ||
| 73 | + Maybe(Maybe&& other) noexcept : MaybeBase(std::move(other)) {} | ||
| 109 | 74 | using MaybeBase::operator=; | |
| 110 | 75 | }; | |
| 111 | 76 | ||
@@ -114,7 +79,7 @@ class Maybe<String> : public MaybeBase<String> { | |||
| 114 | 79 | public: | |
| 115 | 80 | Maybe() { } | |
| 116 | 81 | Maybe(const String& value) : MaybeBase(value) { } | |
| 117 | - Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {} | ||
| 82 | + Maybe(Maybe&& other) noexcept : MaybeBase(std::move(other)) {} | ||
| 118 | 83 | using MaybeBase::operator=; | |
| 119 | 84 | }; | |
| 120 | 85 | ||
@@ -123,17 +88,12 @@ class Maybe<Binary> : public MaybeBase<Binary> { | |||
| 123 | 88 | public: | |
| 124 | 89 | Maybe() { } | |
| 125 | 90 | Maybe(Binary value) : MaybeBase(value) { } | |
| 126 | - Maybe(Maybe&& other) IP_NOEXCEPT : MaybeBase(std::move(other)) {} | ||
| 91 | + Maybe(Maybe&& other) noexcept : MaybeBase(std::move(other)) {} | ||
| 127 | 92 | using MaybeBase::operator=; | |
| 128 | 93 | }; | |
| 129 | 94 | ||
| 130 | 95 | {% for namespace in config.protocol.namespace %} | |
| 131 | 96 | } // namespace {{namespace}} | |
| 132 | 97 | {% endfor %} | |
| 133 | 98 | ||
| 134 | - #undef IP_GNUC_PREREQ | ||
| 135 | - #undef IP_TARGET_ARCH_MIPS64 | ||
| 136 | - #undef IP_TARGET_ARCH_MIPS | ||
| 137 | - #undef IP_NOEXCEPT | ||
| 138 | - | ||
| 139 | 99 | #endif // !defined({{"_".join(config.protocol.namespace)}}_Maybe_h) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments