| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 40b1b18 commit 3cfe194
28 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -254,6 +254,7 @@ | |||
| 254 | 254 | 'src/node_blob.h', | |
| 255 | 255 | 'src/node_buffer.h', | |
| 256 | 256 | 'src/node_builtins.h', | |
| 257 | + 'src/node_concepts.h', | ||
| 257 | 258 | 'src/node_config_file.h', | |
| 258 | 259 | 'src/node_constants.h', | |
| 259 | 260 | 'src/node_context_data.h', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,7 @@ namespace node { | |||
| 12 | 12 | typedef size_t AliasedBufferIndex; | |
| 13 | 13 | ||
| 14 | 14 | template <typename NativeT, typename V8T> | |
| 15 | + requires std::is_scalar_v<NativeT> | ||
| 15 | 16 | AliasedBufferBase<NativeT, V8T>::AliasedBufferBase( | |
| 16 | 17 | v8::Isolate* isolate, const size_t count, const AliasedBufferIndex* index) | |
| 17 | 18 | : isolate_(isolate), count_(count), byte_offset_(0), index_(index) { | |
@@ -34,6 +35,7 @@ AliasedBufferBase<NativeT, V8T>::AliasedBufferBase( | |||
| 34 | 35 | } | |
| 35 | 36 | ||
| 36 | 37 | template <typename NativeT, typename V8T> | |
| 38 | + requires std::is_scalar_v<NativeT> | ||
| 37 | 39 | AliasedBufferBase<NativeT, V8T>::AliasedBufferBase( | |
| 38 | 40 | v8::Isolate* isolate, | |
| 39 | 41 | const size_t byte_offset, | |
@@ -65,6 +67,7 @@ AliasedBufferBase<NativeT, V8T>::AliasedBufferBase( | |||
| 65 | 67 | } | |
| 66 | 68 | ||
| 67 | 69 | template <typename NativeT, typename V8T> | |
| 70 | + requires std::is_scalar_v<NativeT> | ||
| 68 | 71 | AliasedBufferBase<NativeT, V8T>::AliasedBufferBase( | |
| 69 | 72 | const AliasedBufferBase& that) | |
| 70 | 73 | : isolate_(that.isolate_), | |
@@ -76,13 +79,15 @@ AliasedBufferBase<NativeT, V8T>::AliasedBufferBase( | |||
| 76 | 79 | } | |
| 77 | 80 | ||
| 78 | 81 | template <typename NativeT, typename V8T> | |
| 82 | + requires std::is_scalar_v<NativeT> | ||
| 79 | 83 | AliasedBufferIndex AliasedBufferBase<NativeT, V8T>::Serialize( | |
| 80 | 84 | v8::Local<v8::Context> context, v8::SnapshotCreator* creator) { | |
| 81 | 85 | DCHECK(is_valid()); | |
| 82 | 86 | return creator->AddData(context, GetJSArray()); | |
| 83 | 87 | } | |
| 84 | 88 | ||
| 85 | 89 | template <typename NativeT, typename V8T> | |
| 90 | + requires std::is_scalar_v<NativeT> | ||
| 86 | 91 | inline void AliasedBufferBase<NativeT, V8T>::Deserialize( | |
| 87 | 92 | v8::Local<v8::Context> context) { | |
| 88 | 93 | DCHECK_NOT_NULL(index_); | |
@@ -99,6 +104,7 @@ inline void AliasedBufferBase<NativeT, V8T>::Deserialize( | |||
| 99 | 104 | } | |
| 100 | 105 | ||
| 101 | 106 | template <typename NativeT, typename V8T> | |
| 107 | + requires std::is_scalar_v<NativeT> | ||
| 102 | 108 | AliasedBufferBase<NativeT, V8T>& AliasedBufferBase<NativeT, V8T>::operator=( | |
| 103 | 109 | AliasedBufferBase<NativeT, V8T>&& that) noexcept { | |
| 104 | 110 | DCHECK(is_valid()); | |
@@ -116,41 +122,48 @@ AliasedBufferBase<NativeT, V8T>& AliasedBufferBase<NativeT, V8T>::operator=( | |||
| 116 | 122 | } | |
| 117 | 123 | ||
| 118 | 124 | template <typename NativeT, typename V8T> | |
| 125 | + requires std::is_scalar_v<NativeT> | ||
| 119 | 126 | v8::Local<V8T> AliasedBufferBase<NativeT, V8T>::GetJSArray() const { | |
| 120 | 127 | DCHECK(is_valid()); | |
| 121 | 128 | return js_array_.Get(isolate_); | |
| 122 | 129 | } | |
| 123 | 130 | ||
| 124 | 131 | template <typename NativeT, typename V8T> | |
| 132 | + requires std::is_scalar_v<NativeT> | ||
| 125 | 133 | void AliasedBufferBase<NativeT, V8T>::Release() { | |
| 126 | 134 | DCHECK_NULL(index_); | |
| 127 | 135 | js_array_.Reset(); | |
| 128 | 136 | } | |
| 129 | 137 | ||
| 130 | 138 | template <typename NativeT, typename V8T> | |
| 139 | + requires std::is_scalar_v<NativeT> | ||
| 131 | 140 | inline void AliasedBufferBase<NativeT, V8T>::MakeWeak() { | |
| 132 | 141 | DCHECK(is_valid()); | |
| 133 | 142 | js_array_.SetWeak(); | |
| 134 | 143 | } | |
| 135 | 144 | ||
| 136 | 145 | template <typename NativeT, typename V8T> | |
| 146 | + requires std::is_scalar_v<NativeT> | ||
| 137 | 147 | v8::Local<v8::ArrayBuffer> AliasedBufferBase<NativeT, V8T>::GetArrayBuffer() | |
| 138 | 148 | const { | |
| 139 | 149 | return GetJSArray()->Buffer(); | |
| 140 | 150 | } | |
| 141 | 151 | ||
| 142 | 152 | template <typename NativeT, typename V8T> | |
| 153 | + requires std::is_scalar_v<NativeT> | ||
| 143 | 154 | inline const NativeT* AliasedBufferBase<NativeT, V8T>::GetNativeBuffer() const { | |
| 144 | 155 | DCHECK(is_valid()); | |
| 145 | 156 | return buffer_; | |
| 146 | 157 | } | |
| 147 | 158 | ||
| 148 | 159 | template <typename NativeT, typename V8T> | |
| 160 | + requires std::is_scalar_v<NativeT> | ||
| 149 | 161 | inline const NativeT* AliasedBufferBase<NativeT, V8T>::operator*() const { | |
| 150 | 162 | return GetNativeBuffer(); | |
| 151 | 163 | } | |
| 152 | 164 | ||
| 153 | 165 | template <typename NativeT, typename V8T> | |
| 166 | + requires std::is_scalar_v<NativeT> | ||
| 154 | 167 | inline void AliasedBufferBase<NativeT, V8T>::SetValue(const size_t index, | |
| 155 | 168 | NativeT value) { | |
| 156 | 169 | DCHECK_LT(index, count_); | |
@@ -159,6 +172,7 @@ inline void AliasedBufferBase<NativeT, V8T>::SetValue(const size_t index, | |||
| 159 | 172 | } | |
| 160 | 173 | ||
| 161 | 174 | template <typename NativeT, typename V8T> | |
| 175 | + requires std::is_scalar_v<NativeT> | ||
| 162 | 176 | inline const NativeT AliasedBufferBase<NativeT, V8T>::GetValue( | |
| 163 | 177 | const size_t index) const { | |
| 164 | 178 | DCHECK(is_valid()); | |
@@ -167,23 +181,27 @@ inline const NativeT AliasedBufferBase<NativeT, V8T>::GetValue( | |||
| 167 | 181 | } | |
| 168 | 182 | ||
| 169 | 183 | template <typename NativeT, typename V8T> | |
| 184 | + requires std::is_scalar_v<NativeT> | ||
| 170 | 185 | typename AliasedBufferBase<NativeT, V8T>::Reference | |
| 171 | 186 | AliasedBufferBase<NativeT, V8T>::operator[](size_t index) { | |
| 172 | 187 | DCHECK(is_valid()); | |
| 173 | 188 | return Reference(this, index); | |
| 174 | 189 | } | |
| 175 | 190 | ||
| 176 | 191 | template <typename NativeT, typename V8T> | |
| 192 | + requires std::is_scalar_v<NativeT> | ||
| 177 | 193 | NativeT AliasedBufferBase<NativeT, V8T>::operator[](size_t index) const { | |
| 178 | 194 | return GetValue(index); | |
| 179 | 195 | } | |
| 180 | 196 | ||
| 181 | 197 | template <typename NativeT, typename V8T> | |
| 198 | + requires std::is_scalar_v<NativeT> | ||
| 182 | 199 | size_t AliasedBufferBase<NativeT, V8T>::Length() const { | |
| 183 | 200 | return count_; | |
| 184 | 201 | } | |
| 185 | 202 | ||
| 186 | 203 | template <typename NativeT, typename V8T> | |
| 204 | + requires std::is_scalar_v<NativeT> | ||
| 187 | 205 | void AliasedBufferBase<NativeT, V8T>::reserve(size_t new_capacity) { | |
| 188 | 206 | DCHECK(is_valid()); | |
| 189 | 207 | DCHECK_GE(new_capacity, count_); | |
@@ -214,11 +232,13 @@ void AliasedBufferBase<NativeT, V8T>::reserve(size_t new_capacity) { | |||
| 214 | 232 | } | |
| 215 | 233 | ||
| 216 | 234 | template <typename NativeT, typename V8T> | |
| 235 | + requires std::is_scalar_v<NativeT> | ||
| 217 | 236 | inline bool AliasedBufferBase<NativeT, V8T>::is_valid() const { | |
| 218 | 237 | return index_ == nullptr && !js_array_.IsEmpty(); | |
| 219 | 238 | } | |
| 220 | 239 | ||
| 221 | 240 | template <typename NativeT, typename V8T> | |
| 241 | + requires std::is_scalar_v<NativeT> | ||
| 222 | 242 | inline size_t AliasedBufferBase<NativeT, V8T>::SelfSize() const { | |
| 223 | 243 | return sizeof(*this); | |
| 224 | 244 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,10 +29,9 @@ typedef size_t AliasedBufferIndex; | |||
| 29 | 29 | * observed. Any notification APIs will be left as a future exercise. | |
| 30 | 30 | */ | |
| 31 | 31 | template <class NativeT, class V8T> | |
| 32 | + requires std::is_scalar_v<NativeT> | ||
| 32 | 33 | class AliasedBufferBase final : public MemoryRetainer { | |
| 33 | 34 | public: | |
| 34 | - static_assert(std::is_scalar_v<NativeT>); | ||
| 35 | - | ||
| 36 | 35 | AliasedBufferBase(v8::Isolate* isolate, | |
| 37 | 36 | size_t count, | |
| 38 | 37 | const AliasedBufferIndex* index = nullptr); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,8 +90,8 @@ std::string BlobSerializerDeserializer::GetName() const { | |||
| 90 | 90 | // Helper for reading numeric types. | |
| 91 | 91 | template <typename Impl> | |
| 92 | 92 | template <typename T> | |
| 93 | + requires std::is_arithmetic_v<T> | ||
| 93 | 94 | T BlobDeserializer<Impl>::ReadArithmetic() { | |
| 94 | - static_assert(std::is_arithmetic_v<T>, "Not an arithmetic type"); | ||
| 95 | 95 | T result; | |
| 96 | 96 | ReadArithmetic(&result, 1); | |
| 97 | 97 | return result; | |
@@ -158,8 +158,8 @@ std::string_view BlobDeserializer<Impl>::ReadStringView(StringLogMode mode) { | |||
| 158 | 158 | // Helper for reading an array of numeric types. | |
| 159 | 159 | template <typename Impl> | |
| 160 | 160 | template <typename T> | |
| 161 | + requires std::is_arithmetic_v<T> | ||
| 161 | 162 | void BlobDeserializer<Impl>::ReadArithmetic(T* out, size_t count) { | |
| 162 | - static_assert(std::is_arithmetic_v<T>, "Not an arithmetic type"); | ||
| 163 | 163 | DCHECK_GT(count, 0); // Should not read contents for vectors of size 0. | |
| 164 | 164 | if (is_debug) { | |
| 165 | 165 | std::string name = GetName<T>(); | |
@@ -180,8 +180,8 @@ void BlobDeserializer<Impl>::ReadArithmetic(T* out, size_t count) { | |||
| 180 | 180 | // Helper for reading numeric vectors. | |
| 181 | 181 | template <typename Impl> | |
| 182 | 182 | template <typename Number> | |
| 183 | + requires std::is_arithmetic_v<Number> | ||
| 183 | 184 | std::vector<Number> BlobDeserializer<Impl>::ReadArithmeticVector(size_t count) { | |
| 184 | - static_assert(std::is_arithmetic_v<Number>, "Not an arithmetic type"); | ||
| 185 | 185 | DCHECK_GT(count, 0); // Should not read contents for vectors of size 0. | |
| 186 | 186 | std::vector<Number> result(count); | |
| 187 | 187 | ReadArithmetic(result.data(), count); | |
@@ -191,8 +191,8 @@ std::vector<Number> BlobDeserializer<Impl>::ReadArithmeticVector(size_t count) { | |||
| 191 | 191 | // Helper for reading non-numeric vectors. | |
| 192 | 192 | template <typename Impl> | |
| 193 | 193 | template <typename T> | |
| 194 | + requires(!std::is_arithmetic_v<T>) | ||
| 194 | 195 | std::vector<T> BlobDeserializer<Impl>::ReadNonArithmeticVector(size_t count) { | |
| 195 | - static_assert(!std::is_arithmetic_v<T>, "Arithmetic type"); | ||
| 196 | 196 | DCHECK_GT(count, 0); // Should not read contents for vectors of size 0. | |
| 197 | 197 | std::vector<T> result; | |
| 198 | 198 | result.reserve(count); | |
@@ -224,8 +224,8 @@ T BlobDeserializer<Impl>::ReadElement() { | |||
| 224 | 224 | // Helper for writing numeric types. | |
| 225 | 225 | template <typename Impl> | |
| 226 | 226 | template <typename T> | |
| 227 | + requires std::is_arithmetic_v<T> | ||
| 227 | 228 | size_t BlobSerializer<Impl>::WriteArithmetic(const T& data) { | |
| 228 | - static_assert(std::is_arithmetic_v<T>, "Not an arithmetic type"); | ||
| 229 | 229 | return WriteArithmetic(&data, 1); | |
| 230 | 230 | } | |
| 231 | 231 | ||
@@ -303,8 +303,8 @@ static size_t kPreviewCount = 16; | |||
| 303 | 303 | // Helper for writing an array of numeric types. | |
| 304 | 304 | template <typename Impl> | |
| 305 | 305 | template <typename T> | |
| 306 | + requires std::is_arithmetic_v<T> | ||
| 306 | 307 | size_t BlobSerializer<Impl>::WriteArithmetic(const T* data, size_t count) { | |
| 307 | - static_assert(std::is_arithmetic_v<T>, "Arithmetic type"); | ||
| 308 | 308 | DCHECK_GT(count, 0); // Should not write contents for vectors of size 0. | |
| 309 | 309 | if (is_debug) { | |
| 310 | 310 | size_t preview_count = count < kPreviewCount ? count : kPreviewCount; | |
@@ -338,18 +338,18 @@ size_t BlobSerializer<Impl>::WriteArithmetic(const T* data, size_t count) { | |||
| 338 | 338 | // Helper for writing numeric vectors. | |
| 339 | 339 | template <typename Impl> | |
| 340 | 340 | template <typename Number> | |
| 341 | + requires std::is_arithmetic_v<Number> | ||
| 341 | 342 | size_t BlobSerializer<Impl>::WriteArithmeticVector( | |
| 342 | 343 | const std::vector<Number>& data) { | |
| 343 | - static_assert(std::is_arithmetic_v<Number>, "Arithmetic type"); | ||
| 344 | 344 | return WriteArithmetic(data.data(), data.size()); | |
| 345 | 345 | } | |
| 346 | 346 | ||
| 347 | 347 | // Helper for writing non-numeric vectors. | |
| 348 | 348 | template <typename Impl> | |
| 349 | 349 | template <typename T> | |
| 350 | - size_t BlobSerializer<Impl>::WriteNonArithmeticVector( | ||
| 351 | - const std::vector<T>& data) { | ||
| 352 | - static_assert(!std::is_arithmetic_v<T>, "Arithmetic type"); | ||
| 350 | + requires(!std::is_arithmetic_v<T>) | ||
| 351 | + size_t | ||
| 352 | + BlobSerializer<Impl>::WriteNonArithmeticVector(const std::vector<T>& data) { | ||
| 353 | 353 | DCHECK_GT(data.size(), | |
| 354 | 354 | 0); // Should not write contents for vectors of size 0. | |
| 355 | 355 | size_t written_total = 0; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,7 +1,9 @@ | |||
| 1 | 1 | #ifndef SRC_BLOB_SERIALIZER_DESERIALIZER_H_ | |
| 2 | 2 | #define SRC_BLOB_SERIALIZER_DESERIALIZER_H_ | |
| 3 | 3 | ||
| 4 | + #include <concepts> | ||
| 4 | 5 | #include <string> | |
| 6 | + #include <type_traits> | ||
| 5 | 7 | #include <vector> | |
| 6 | 8 | ||
| 7 | 9 | #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS | |
@@ -49,6 +51,7 @@ class BlobDeserializer : public BlobSerializerDeserializer { | |||
| 49 | 51 | ||
| 50 | 52 | // Helper for reading numeric types. | |
| 51 | 53 | template <typename T> | |
| 54 | + requires std::is_arithmetic_v<T> | ||
| 52 | 55 | T ReadArithmetic(); | |
| 53 | 56 | ||
| 54 | 57 | // Layout of vectors: | |
@@ -63,15 +66,18 @@ class BlobDeserializer : public BlobSerializerDeserializer { | |||
| 63 | 66 | ||
| 64 | 67 | // Helper for reading an array of numeric types. | |
| 65 | 68 | template <typename T> | |
| 69 | + requires std::is_arithmetic_v<T> | ||
| 66 | 70 | void ReadArithmetic(T* out, size_t count); | |
| 67 | 71 | ||
| 68 | 72 | // Helper for reading numeric vectors. | |
| 69 | 73 | template <typename Number> | |
| 74 | + requires std::is_arithmetic_v<Number> | ||
| 70 | 75 | std::vector<Number> ReadArithmeticVector(size_t count); | |
| 71 | 76 | ||
| 72 | 77 | private: | |
| 73 | 78 | // Helper for reading non-numeric vectors. | |
| 74 | 79 | template <typename T> | |
| 80 | + requires(!std::is_arithmetic_v<T>) | ||
| 75 | 81 | std::vector<T> ReadNonArithmeticVector(size_t count); | |
| 76 | 82 | ||
| 77 | 83 | template <typename T> | |
@@ -94,6 +100,7 @@ class BlobSerializer : public BlobSerializerDeserializer { | |||
| 94 | 100 | ||
| 95 | 101 | // Helper for writing numeric types. | |
| 96 | 102 | template <typename T> | |
| 103 | + requires std::is_arithmetic_v<T> | ||
| 97 | 104 | size_t WriteArithmetic(const T& data); | |
| 98 | 105 | ||
| 99 | 106 | // Layout of vectors: | |
@@ -110,15 +117,18 @@ class BlobSerializer : public BlobSerializerDeserializer { | |||
| 110 | 117 | ||
| 111 | 118 | // Helper for writing an array of numeric types. | |
| 112 | 119 | template <typename T> | |
| 120 | + requires std::is_arithmetic_v<T> | ||
| 113 | 121 | size_t WriteArithmetic(const T* data, size_t count); | |
| 114 | 122 | ||
| 115 | 123 | // Helper for writing numeric vectors. | |
| 116 | 124 | template <typename Number> | |
| 125 | + requires std::is_arithmetic_v<Number> | ||
| 117 | 126 | size_t WriteArithmeticVector(const std::vector<Number>& data); | |
| 118 | 127 | ||
| 119 | 128 | private: | |
| 120 | 129 | // Helper for writing non-numeric vectors. | |
| 121 | 130 | template <typename T> | |
| 131 | + requires(!std::is_arithmetic_v<T>) | ||
| 122 | 132 | size_t WriteNonArithmeticVector(const std::vector<T>& data); | |
| 123 | 133 | ||
| 124 | 134 | template <typename T> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -259,7 +259,7 @@ WebCryptoCipherStatus AES_KW_Cipher(Environment* env, | |||
| 259 | 259 | // implementation here: | |
| 260 | 260 | // https://github.com/chromium/chromium/blob/7af6cfd/components/webcrypto/algorithms/aes_ctr.cc | |
| 261 | 261 | ||
| 262 | - template <typename T> | ||
| 262 | + template <std::integral T> | ||
| 263 | 263 | T CeilDiv(T a, T b) { | |
| 264 | 264 | return a == 0 ? 0 : 1 + (a - 1) / b; | |
| 265 | 265 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -732,8 +732,8 @@ class ArrayBufferOrViewContents final { | |||
| 732 | 732 | } | |
| 733 | 733 | ||
| 734 | 734 | template <typename M> | |
| 735 | + requires(sizeof(M) == 1) | ||
| 735 | 736 | void CopyTo(M* dest, size_t len) const { | |
| 736 | - static_assert(sizeof(M) == 1, "sizeof(M) must equal 1"); | ||
| 737 | 737 | len = std::min(len, size()); | |
| 738 | 738 | if (len > 0 && data() != nullptr) { | |
| 739 | 739 | memcpy(dest, data(), len); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,10 +49,7 @@ struct ToStringHelper { | |||
| 49 | 49 | return value.ToStringView(); | |
| 50 | 50 | } | |
| 51 | 51 | ||
| 52 | - template <typename T, | ||
| 53 | - typename test_for_number = typename std:: | ||
| 54 | - enable_if_t<std::is_arithmetic_v<T> || std::is_enum_v<T>, bool>, | ||
| 55 | - typename dummy = bool> | ||
| 52 | + template <NumericOrEnum T> | ||
| 56 | 53 | static std::string Convert(const T& value) { | |
| 57 | 54 | return std::to_string(value); | |
| 58 | 55 | } | |
@@ -81,9 +78,7 @@ struct ToStringHelper { | |||
| 81 | 78 | return utf8_value.ToString(); | |
| 82 | 79 | } | |
| 83 | 80 | ||
| 84 | - template <unsigned BASE_BITS, | ||
| 85 | - typename T, | ||
| 86 | - typename = std::enable_if_t<std::is_integral_v<T>>> | ||
| 81 | + template <unsigned BASE_BITS, std::integral T> | ||
| 87 | 82 | static std::string BaseConvert(const T& value) { | |
| 88 | 83 | auto v = static_cast<uint64_t>(value); | |
| 89 | 84 | char ret[3 * sizeof(T)]; | |
@@ -96,9 +91,8 @@ struct ToStringHelper { | |||
| 96 | 91 | } while ((v >>= BASE_BITS) != 0); | |
| 97 | 92 | return ptr; | |
| 98 | 93 | } | |
| 99 | - template <unsigned BASE_BITS, | ||
| 100 | - typename T, | ||
| 101 | - typename = std::enable_if_t<!std::is_integral_v<T>>> | ||
| 94 | + template <unsigned BASE_BITS, typename T> | ||
| 95 | + requires(!std::integral<T>) | ||
| 102 | 96 | static auto BaseConvert(T&& value) { | |
| 103 | 97 | return Convert(std::forward<T>(value)); | |
| 104 | 98 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | 4 | #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS | |
| 5 | 5 | ||
| 6 | + #include "node_concepts.h" | ||
| 7 | + | ||
| 6 | 8 | #include <iomanip> | |
| 7 | 9 | #include <limits> | |
| 8 | 10 | #include <ostream> | |
@@ -132,9 +134,7 @@ class JSONWriter { | |||
| 132 | 134 | }; | |
| 133 | 135 | ||
| 134 | 136 | private: | |
| 135 | - template <typename T, | ||
| 136 | - typename test_for_number = typename std:: | ||
| 137 | - enable_if<std::numeric_limits<T>::is_specialized, bool>::type> | ||
| 137 | + template <NumericValue T> | ||
| 138 | 138 | inline void write_value(T number) { | |
| 139 | 139 | if constexpr (std::is_same<T, bool>::value) | |
| 140 | 140 | out_ << (number ? "true" : "false"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -203,7 +203,7 @@ void MemoryTracker::TrackField(const char* edge_name, | |||
| 203 | 203 | TrackField(edge_name, container, node_name, element_name); | |
| 204 | 204 | } | |
| 205 | 205 | ||
| 206 | - template <typename T, typename test_for_number, typename dummy> | ||
| 206 | + template <NumericValue T> | ||
| 207 | 207 | void MemoryTracker::TrackField(const char* edge_name, | |
| 208 | 208 | const T& value, | |
| 209 | 209 | const char* node_name) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments