@shopify/react-native-skia 0.1.129 → 0.1.130
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +1 -0
- package/cpp/api/JsiSkRuntimeEffect.h +7 -9
- package/cpp/api/JsiSkVertices.h +0 -2
- package/cpp/rnskia/values/RNSkValue.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +7 -1
- package/cpp/skia/include/core/SkAlphaType.h +45 -0
- package/cpp/skia/include/core/SkBitmap.h +4 -2
- package/cpp/skia/include/core/SkCanvas.h +31 -20
- package/cpp/skia/include/core/SkColor.h +1 -1
- package/cpp/skia/include/core/SkColorFilter.h +1 -0
- package/cpp/skia/include/core/SkColorType.h +66 -0
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +1 -1
- package/cpp/skia/include/core/SkDrawable.h +7 -0
- package/cpp/skia/include/core/SkEncodedImageFormat.h +1 -0
- package/cpp/skia/include/core/SkFont.h +4 -3
- package/cpp/skia/include/core/SkFontArguments.h +33 -1
- package/cpp/skia/include/core/SkGraphics.h +13 -0
- package/cpp/skia/include/core/SkImage.h +67 -22
- package/cpp/skia/include/core/SkImageEncoder.h +0 -3
- package/cpp/skia/include/core/SkImageGenerator.h +4 -3
- package/cpp/skia/include/core/SkImageInfo.h +35 -142
- package/cpp/skia/include/core/SkMesh.h +303 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkOpenTypeSVGDecoder.h +30 -0
- package/cpp/skia/include/core/SkPaint.h +4 -19
- package/cpp/skia/include/core/SkPath.h +20 -33
- package/cpp/skia/include/core/SkPathBuilder.h +1 -6
- package/cpp/skia/include/core/SkPixelRef.h +1 -1
- package/cpp/skia/include/core/SkPixmap.h +3 -2
- package/cpp/skia/include/core/SkRSXform.h +1 -1
- package/cpp/skia/include/core/SkSamplingOptions.h +16 -5
- package/cpp/skia/include/core/SkSpan.h +5 -5
- package/cpp/skia/include/core/SkString.h +5 -8
- package/cpp/skia/include/core/SkSurface.h +21 -0
- package/cpp/skia/include/core/SkTypeface.h +20 -4
- package/cpp/skia/include/core/SkTypes.h +9 -5
- package/cpp/skia/include/effects/SkGradientShader.h +9 -18
- package/cpp/skia/include/effects/SkRuntimeEffect.h +16 -12
- package/cpp/skia/include/gpu/GpuTypes.h +32 -0
- package/cpp/skia/include/gpu/GrBackendSemaphore.h +1 -1
- package/cpp/skia/include/gpu/GrBackendSurface.h +6 -5
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +1 -1
- package/cpp/skia/include/gpu/GrContextOptions.h +11 -20
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +7 -0
- package/cpp/skia/include/gpu/GrDirectContext.h +16 -11
- package/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +0 -2
- package/cpp/skia/include/gpu/GrRecordingContext.h +14 -7
- package/cpp/skia/include/gpu/GrSurfaceInfo.h +6 -6
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +1 -1
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +3 -1
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -2
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +64 -0
- package/cpp/skia/include/gpu/graphite/Context.h +124 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +71 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +104 -0
- package/cpp/skia/include/gpu/graphite/Recording.h +39 -0
- package/cpp/skia/include/gpu/graphite/SkStuff.h +47 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +91 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +24 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlTypes.h +68 -0
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +1 -2
- package/cpp/skia/include/ports/SkCFObject.h +0 -4
- package/cpp/skia/include/ports/SkTypeface_win.h +2 -2
- package/cpp/skia/include/private/{GrSingleOwner.h → SingleOwner.h} +17 -10
- package/cpp/skia/include/private/SkChecksum.h +11 -0
- package/cpp/skia/include/private/SkEncodedInfo.h +22 -5
- package/cpp/skia/include/private/SkFloatingPoint.h +0 -53
- package/cpp/skia/include/private/SkImageInfoPriv.h +8 -2
- package/cpp/skia/include/private/SkMacros.h +13 -18
- package/cpp/skia/include/private/SkMutex.h +8 -0
- package/cpp/skia/include/private/SkPathRef.h +2 -16
- package/cpp/skia/include/private/SkSLDefines.h +9 -1
- package/cpp/skia/include/private/SkSLIRNode.h +6 -5
- package/cpp/skia/include/private/SkSLLayout.h +11 -10
- package/cpp/skia/include/private/SkSLModifiers.h +4 -3
- package/cpp/skia/include/private/SkSLProgramElement.h +2 -2
- package/cpp/skia/include/private/SkSLProgramKind.h +8 -5
- package/cpp/skia/include/private/SkSLStatement.h +2 -3
- package/cpp/skia/include/private/SkSLString.h +17 -56
- package/cpp/skia/include/private/SkSLSymbol.h +4 -4
- package/cpp/skia/include/private/SkShadowFlags.h +3 -1
- package/cpp/skia/include/private/SkStringView.h +47 -0
- package/cpp/skia/include/private/SkTArray.h +4 -3
- package/cpp/skia/include/private/SkTHash.h +66 -24
- package/cpp/skia/include/private/SkTLogic.h +2 -32
- package/cpp/skia/include/private/SkTemplates.h +2 -2
- package/cpp/skia/include/private/SkThreadAnnotations.h +4 -4
- package/cpp/skia/include/private/SkVx.h +28 -28
- package/cpp/skia/include/private/chromium/GrSlug.h +40 -3
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +12 -6
- package/cpp/skia/include/private/{GrContext_Base.h → gpu/ganesh/GrContext_Base.h} +7 -0
- package/cpp/skia/include/private/{GrD3DTypesMinimal.h → gpu/ganesh/GrD3DTypesMinimal.h} +0 -0
- package/cpp/skia/include/private/{GrDawnTypesPriv.h → gpu/ganesh/GrDawnTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrGLTypesPriv.h → gpu/ganesh/GrGLTypesPriv.h} +1 -0
- package/cpp/skia/include/private/{GrImageContext.h → gpu/ganesh/GrImageContext.h} +4 -4
- package/cpp/skia/include/private/{GrMockTypesPriv.h → gpu/ganesh/GrMockTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrMtlTypesPriv.h → gpu/ganesh/GrMtlTypesPriv.h} +0 -0
- package/cpp/skia/include/private/{GrTypesPriv.h → gpu/ganesh/GrTypesPriv.h} +25 -367
- package/cpp/skia/include/private/{GrVkTypesPriv.h → gpu/ganesh/GrVkTypesPriv.h} +0 -0
- package/cpp/skia/include/private/gpu/graphite/MtlTypesPriv.h +74 -0
- package/cpp/skia/include/sksl/DSL.h +4 -0
- package/cpp/skia/include/sksl/DSLBlock.h +8 -3
- package/cpp/skia/include/sksl/DSLCase.h +6 -6
- package/cpp/skia/include/sksl/DSLCore.h +89 -78
- package/cpp/skia/include/sksl/DSLExpression.h +78 -45
- package/cpp/skia/include/sksl/DSLFunction.h +23 -18
- package/cpp/skia/include/sksl/DSLLayout.h +14 -16
- package/cpp/skia/include/sksl/DSLModifiers.h +7 -5
- package/cpp/skia/include/sksl/DSLRuntimeEffects.h +1 -1
- package/cpp/skia/include/sksl/DSLStatement.h +16 -10
- package/cpp/skia/include/sksl/DSLSymbols.h +7 -7
- package/cpp/skia/include/sksl/DSLType.h +27 -23
- package/cpp/skia/include/sksl/DSLVar.h +72 -61
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +12 -49
- package/cpp/skia/include/sksl/SkSLOperator.h +151 -0
- package/cpp/skia/include/sksl/SkSLPosition.h +102 -0
- package/cpp/skia/include/svg/SkSVGCanvas.h +5 -1
- package/cpp/skia/include/utils/SkAnimCodecPlayer.h +7 -0
- package/cpp/skia/include/utils/SkCamera.h +2 -0
- package/cpp/skia/include/utils/SkCanvasStateUtils.h +4 -1
- package/cpp/skia/include/utils/SkCustomTypeface.h +6 -4
- package/cpp/skia/include/utils/SkNWayCanvas.h +34 -0
- package/cpp/skia/include/utils/SkNullCanvas.h +5 -1
- package/cpp/skia/include/utils/SkOrderedFontMgr.h +12 -0
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +30 -1
- package/cpp/skia/include/utils/SkParse.h +2 -0
- package/cpp/skia/include/utils/SkShadowUtils.h +3 -2
- package/cpp/skia/include/utils/SkTextUtils.h +8 -4
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +27 -1
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +4 -0
- package/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +32 -0
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +2 -0
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +48 -9
- package/ios/RNSkia-iOS/PlatformContext.h +1 -1
- package/ios/RNSkia-iOS/RNSkDrawViewImpl.mm +1 -0
- package/ios/RNSkia-iOS/SkiaDrawView.mm +1 -1
- package/lib/commonjs/renderer/components/shaders/Shader.js +1 -2
- package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/module/renderer/components/shaders/Shader.js +1 -2
- package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
- package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +0 -1
- package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +2 -4
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +2 -2
- package/src/renderer/components/shaders/Shader.tsx +1 -3
- package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +1 -8
- package/cpp/skia/include/core/SkCustomMesh.h +0 -202
- package/cpp/skia/include/core/SkStringView.h +0 -185
- package/cpp/skia/include/private/SkPaintParamsKey.h +0 -110
- package/cpp/skia/include/private/SkShaderCodeDictionary.h +0 -63
- package/cpp/skia/include/private/SkTOptional.h +0 -362
@@ -1,362 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2021 Google LLC.
|
3
|
-
*
|
4
|
-
* Use of this source code is governed by a BSD-style license that can be
|
5
|
-
* found in the LICENSE file.
|
6
|
-
*/
|
7
|
-
|
8
|
-
#ifndef SkTOptional_DEFINED
|
9
|
-
#define SkTOptional_DEFINED
|
10
|
-
|
11
|
-
#include "include/core/SkTypes.h"
|
12
|
-
|
13
|
-
#include <utility>
|
14
|
-
|
15
|
-
namespace skstd {
|
16
|
-
|
17
|
-
/**
|
18
|
-
* An empty optional is represented with `nullopt`.
|
19
|
-
*/
|
20
|
-
struct nullopt_t {
|
21
|
-
struct tag {};
|
22
|
-
|
23
|
-
// nullopt_t must not be default-constructible.
|
24
|
-
explicit constexpr nullopt_t(tag) {}
|
25
|
-
};
|
26
|
-
|
27
|
-
static constexpr nullopt_t nullopt{nullopt_t::tag{}};
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Simple drop-in replacement for std::optional until we move to C++17. This does not have all of
|
31
|
-
* std::optional's capabilities, but it covers our needs for the time being.
|
32
|
-
*/
|
33
|
-
template<typename T>
|
34
|
-
class optional {
|
35
|
-
public:
|
36
|
-
optional(const T& value)
|
37
|
-
: fHasValue(true) {
|
38
|
-
new(&fPayload.fValue) T(value);
|
39
|
-
}
|
40
|
-
|
41
|
-
optional(T&& value)
|
42
|
-
: fHasValue(true) {
|
43
|
-
new(&fPayload.fValue) T(std::move(value));
|
44
|
-
}
|
45
|
-
|
46
|
-
optional() {}
|
47
|
-
|
48
|
-
optional(const optional& other) {
|
49
|
-
*this = other;
|
50
|
-
}
|
51
|
-
|
52
|
-
// Construction with nullopt is the same as default construction.
|
53
|
-
optional(nullopt_t) : optional() {}
|
54
|
-
|
55
|
-
// We need a non-const copy constructor because otherwise optional(nonConstSrc) isn't an exact
|
56
|
-
// match for the copy constructor, and we'd end up invoking the Args&&... template by mistake.
|
57
|
-
optional(optional& other) {
|
58
|
-
*this = other;
|
59
|
-
}
|
60
|
-
|
61
|
-
optional(optional&& other) {
|
62
|
-
*this = std::move(other);
|
63
|
-
}
|
64
|
-
|
65
|
-
template<typename... Args>
|
66
|
-
optional(Args&&... args) {
|
67
|
-
fHasValue = true;
|
68
|
-
new(&fPayload.fValue) T(std::forward<Args>(args)...);
|
69
|
-
}
|
70
|
-
|
71
|
-
~optional() {
|
72
|
-
this->reset();
|
73
|
-
}
|
74
|
-
|
75
|
-
optional& operator=(const optional& other) {
|
76
|
-
if (this != &other) {
|
77
|
-
if (fHasValue) {
|
78
|
-
if (other.fHasValue) {
|
79
|
-
fPayload.fValue = other.fPayload.fValue;
|
80
|
-
} else {
|
81
|
-
this->reset();
|
82
|
-
}
|
83
|
-
} else {
|
84
|
-
if (other.fHasValue) {
|
85
|
-
fHasValue = true;
|
86
|
-
new (&fPayload.fValue) T(other.fPayload.fValue);
|
87
|
-
} else {
|
88
|
-
// do nothing, no value on either side
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
return *this;
|
93
|
-
}
|
94
|
-
|
95
|
-
optional& operator=(optional&& other) {
|
96
|
-
if (this != &other) {
|
97
|
-
if (fHasValue) {
|
98
|
-
if (other.fHasValue) {
|
99
|
-
fPayload.fValue = std::move(other.fPayload.fValue);
|
100
|
-
} else {
|
101
|
-
this->reset();
|
102
|
-
}
|
103
|
-
} else {
|
104
|
-
if (other.fHasValue) {
|
105
|
-
fHasValue = true;
|
106
|
-
new (&fPayload.fValue) T(std::move(other.fPayload.fValue));
|
107
|
-
} else {
|
108
|
-
// do nothing, no value on either side
|
109
|
-
}
|
110
|
-
}
|
111
|
-
}
|
112
|
-
return *this;
|
113
|
-
}
|
114
|
-
|
115
|
-
template<typename... Args>
|
116
|
-
optional& emplace(Args&&... args) {
|
117
|
-
this->reset();
|
118
|
-
fHasValue = true;
|
119
|
-
new(&fPayload.fValue) T(std::forward<Args>(args)...);
|
120
|
-
return *this;
|
121
|
-
}
|
122
|
-
|
123
|
-
template<typename U, typename... Args>
|
124
|
-
optional& emplace(std::initializer_list<U> il, Args&&... args) {
|
125
|
-
this->reset();
|
126
|
-
fHasValue = true;
|
127
|
-
new(&fPayload.fValue) T(il, std::forward<Args>(args)...);
|
128
|
-
return *this;
|
129
|
-
}
|
130
|
-
|
131
|
-
// Assignment to nullopt is the same as reset().
|
132
|
-
optional& operator=(nullopt_t) {
|
133
|
-
this->reset();
|
134
|
-
return *this;
|
135
|
-
}
|
136
|
-
|
137
|
-
T& operator*() & {
|
138
|
-
SkASSERT(fHasValue);
|
139
|
-
return fPayload.fValue;
|
140
|
-
}
|
141
|
-
|
142
|
-
const T& operator*() const& {
|
143
|
-
SkASSERT(fHasValue);
|
144
|
-
return fPayload.fValue;
|
145
|
-
}
|
146
|
-
|
147
|
-
T&& operator*() && {
|
148
|
-
SkASSERT(fHasValue);
|
149
|
-
return std::move(fPayload.fValue);
|
150
|
-
}
|
151
|
-
|
152
|
-
const T&& operator*() const&& {
|
153
|
-
SkASSERT(fHasValue);
|
154
|
-
return std::move(fPayload.fValue);
|
155
|
-
}
|
156
|
-
|
157
|
-
const T& value() const& {
|
158
|
-
SkASSERT_RELEASE(fHasValue);
|
159
|
-
return **this;
|
160
|
-
}
|
161
|
-
|
162
|
-
T& value() & {
|
163
|
-
SkASSERT_RELEASE(fHasValue);
|
164
|
-
return **this;
|
165
|
-
}
|
166
|
-
|
167
|
-
const T&& value() const&& {
|
168
|
-
SkASSERT_RELEASE(fHasValue);
|
169
|
-
return std::move(**this);
|
170
|
-
}
|
171
|
-
|
172
|
-
T&& value() && {
|
173
|
-
SkASSERT_RELEASE(fHasValue);
|
174
|
-
return std::move(**this);
|
175
|
-
}
|
176
|
-
|
177
|
-
T* operator->() {
|
178
|
-
return &**this;
|
179
|
-
}
|
180
|
-
|
181
|
-
const T* operator->() const {
|
182
|
-
return &**this;
|
183
|
-
}
|
184
|
-
|
185
|
-
template<typename U>
|
186
|
-
T value_or(U&& value) const& {
|
187
|
-
return this->has_value() ? **this : static_cast<T>(std::forward<U>(value));
|
188
|
-
}
|
189
|
-
|
190
|
-
template<typename U>
|
191
|
-
T value_or(U&& value) && {
|
192
|
-
return this->has_value() ? std::move(**this) : static_cast<T>(std::forward<U>(value));
|
193
|
-
}
|
194
|
-
|
195
|
-
bool has_value() const {
|
196
|
-
return fHasValue;
|
197
|
-
}
|
198
|
-
|
199
|
-
explicit operator bool() const {
|
200
|
-
return this->has_value();
|
201
|
-
}
|
202
|
-
|
203
|
-
void reset() {
|
204
|
-
if (fHasValue) {
|
205
|
-
fPayload.fValue.~T();
|
206
|
-
fHasValue = false;
|
207
|
-
}
|
208
|
-
}
|
209
|
-
|
210
|
-
private:
|
211
|
-
union Payload {
|
212
|
-
T fValue;
|
213
|
-
|
214
|
-
Payload() {}
|
215
|
-
|
216
|
-
~Payload() {}
|
217
|
-
} fPayload;
|
218
|
-
|
219
|
-
bool fHasValue = false;
|
220
|
-
};
|
221
|
-
|
222
|
-
// Comparison operators for optional x optional
|
223
|
-
template <typename T, typename U> bool operator==(const optional<T>& a, const optional<U>& b) {
|
224
|
-
return (a.has_value() != b.has_value()) ? false :
|
225
|
-
!a.has_value() ? true :
|
226
|
-
(*a == *b);
|
227
|
-
}
|
228
|
-
|
229
|
-
template <typename T, typename U> bool operator!=(const optional<T>& a, const optional<U>& b) {
|
230
|
-
return (a.has_value() != b.has_value()) ? true :
|
231
|
-
!a.has_value() ? false :
|
232
|
-
(*a != *b);
|
233
|
-
}
|
234
|
-
|
235
|
-
template <typename T, typename U> bool operator<(const optional<T>& a, const optional<U>& b) {
|
236
|
-
return !b.has_value() ? false :
|
237
|
-
!a.has_value() ? true :
|
238
|
-
(*a < *b);
|
239
|
-
}
|
240
|
-
|
241
|
-
template <typename T, typename U> bool operator<=(const optional<T>& a, const optional<U>& b) {
|
242
|
-
return !a.has_value() ? true :
|
243
|
-
!b.has_value() ? false :
|
244
|
-
(*a <= *b);
|
245
|
-
}
|
246
|
-
|
247
|
-
template <typename T, typename U> bool operator>(const optional<T>& a, const optional<U>& b) {
|
248
|
-
return !a.has_value() ? false :
|
249
|
-
!b.has_value() ? true :
|
250
|
-
(*a > *b);
|
251
|
-
}
|
252
|
-
|
253
|
-
template <typename T, typename U> bool operator>=(const optional<T>& a, const optional<U>& b) {
|
254
|
-
return !b.has_value() ? true :
|
255
|
-
!a.has_value() ? false :
|
256
|
-
(*a >= *b);
|
257
|
-
}
|
258
|
-
|
259
|
-
// Comparison operators for optional x nullopt
|
260
|
-
template <typename T> bool operator==(const optional<T>& a, nullopt_t) {
|
261
|
-
return !a.has_value();
|
262
|
-
}
|
263
|
-
|
264
|
-
template <typename T> bool operator!=(const optional<T>& a, nullopt_t) {
|
265
|
-
return a.has_value();
|
266
|
-
}
|
267
|
-
|
268
|
-
template <typename T> bool operator<(const optional<T>&, nullopt_t) {
|
269
|
-
return false;
|
270
|
-
}
|
271
|
-
|
272
|
-
template <typename T> bool operator<=(const optional<T>& a, nullopt_t) {
|
273
|
-
return !a.has_value();
|
274
|
-
}
|
275
|
-
|
276
|
-
template <typename T> bool operator>(const optional<T>& a, nullopt_t) {
|
277
|
-
return a.has_value();
|
278
|
-
}
|
279
|
-
|
280
|
-
template <typename T>
|
281
|
-
bool operator>=(const optional<T>&, nullopt_t) {
|
282
|
-
return true;
|
283
|
-
}
|
284
|
-
|
285
|
-
// Comparison operators for nullopt x optional
|
286
|
-
template <typename U> bool operator==(nullopt_t, const optional<U>& b) {
|
287
|
-
return !b.has_value();
|
288
|
-
}
|
289
|
-
|
290
|
-
template <typename U> bool operator!=(nullopt_t, const optional<U>& b) {
|
291
|
-
return b.has_value();
|
292
|
-
}
|
293
|
-
|
294
|
-
template <typename U> bool operator<(nullopt_t, const optional<U>& b) {
|
295
|
-
return b.has_value();
|
296
|
-
}
|
297
|
-
|
298
|
-
template <typename U> bool operator<=(nullopt_t, const optional<U>&) {
|
299
|
-
return true;
|
300
|
-
}
|
301
|
-
|
302
|
-
template <typename U> bool operator>(nullopt_t, const optional<U>&) {
|
303
|
-
return false;
|
304
|
-
}
|
305
|
-
|
306
|
-
template <typename U> bool operator>=(nullopt_t, const optional<U>& b) {
|
307
|
-
return !b.has_value();
|
308
|
-
}
|
309
|
-
|
310
|
-
// Comparison operators for optional x value
|
311
|
-
template <typename T, typename U> bool operator==(const optional<T>& a, const U& b) {
|
312
|
-
return a.has_value() && (*a == b);
|
313
|
-
}
|
314
|
-
|
315
|
-
template <typename T, typename U> bool operator!=(const optional<T>& a, const U& b) {
|
316
|
-
return !a.has_value() || (*a != b);
|
317
|
-
}
|
318
|
-
|
319
|
-
template <typename T, typename U> bool operator<(const optional<T>& a, const U& b) {
|
320
|
-
return !a.has_value() || (*a < b);
|
321
|
-
}
|
322
|
-
|
323
|
-
template <typename T, typename U> bool operator<=(const optional<T>& a, const U& b) {
|
324
|
-
return !a.has_value() || (*a <= b);
|
325
|
-
}
|
326
|
-
|
327
|
-
template <typename T, typename U> bool operator>(const optional<T>& a, const U& b) {
|
328
|
-
return a.has_value() && (*a > b);
|
329
|
-
}
|
330
|
-
|
331
|
-
template <typename T, typename U> bool operator>=(const optional<T>& a, const U& b) {
|
332
|
-
return a.has_value() && (*a >= b);
|
333
|
-
}
|
334
|
-
|
335
|
-
// Comparison operators for value x optional
|
336
|
-
template <typename T, typename U> bool operator==(const T& a, const optional<U>& b) {
|
337
|
-
return b.has_value() && (a == *b);
|
338
|
-
}
|
339
|
-
|
340
|
-
template <typename T, typename U> bool operator!=(const T& a, const optional<U>& b) {
|
341
|
-
return !b.has_value() || (a != *b);
|
342
|
-
}
|
343
|
-
|
344
|
-
template <typename T, typename U> bool operator<(const T& a, const optional<U>& b) {
|
345
|
-
return b.has_value() && (a < *b);
|
346
|
-
}
|
347
|
-
|
348
|
-
template <typename T, typename U> bool operator<=(const T& a, const optional<U>& b) {
|
349
|
-
return b.has_value() && (a <= *b);
|
350
|
-
}
|
351
|
-
|
352
|
-
template <typename T, typename U> bool operator>(const T& a, const optional<U>& b) {
|
353
|
-
return !b.has_value() || (a > *b);
|
354
|
-
}
|
355
|
-
|
356
|
-
template <typename T, typename U> bool operator>=(const T& a, const optional<U>& b) {
|
357
|
-
return !b.has_value() || (a >= *b);
|
358
|
-
}
|
359
|
-
|
360
|
-
} // namespace skstd
|
361
|
-
|
362
|
-
#endif
|