v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
ostream_operators.h
Go to the documentation of this file.
1
// Copyright 2021 The Chromium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
// Slightly adapted for inclusion in V8.
6
// Copyright 2025 the V8 project authors. All rights reserved.
7
8
#ifndef V8_BASE_NUMERICS_OSTREAM_OPERATORS_H_
9
#define V8_BASE_NUMERICS_OSTREAM_OPERATORS_H_
10
11
#include <ostream>
12
#include <type_traits>
13
14
namespace
v8::base
{
15
namespace
internal
{
16
17
template
<
typename
T>
18
requires
std::is_arithmetic_v<T>
19
class
ClampedNumeric
;
20
template
<
typename
T>
21
requires
std::is_arithmetic_v<T>
22
class
StrictNumeric
;
23
24
// Overload the ostream output operator to make logging work nicely.
25
template
<
typename
T>
26
std::ostream&
operator<<
(std::ostream& os,
const
StrictNumeric<T>
& value) {
27
os << static_cast<T>(value);
28
return
os;
29
}
30
31
// Overload the ostream output operator to make logging work nicely.
32
template
<
typename
T>
33
std::ostream&
operator<<
(std::ostream& os,
const
ClampedNumeric<T>
& value) {
34
os << static_cast<T>(value);
35
return
os;
36
}
37
38
}
// namespace internal
39
}
// namespace v8::base
40
41
#endif
// V8_BASE_NUMERICS_OSTREAM_OPERATORS_H_
v8::base::internal::ClampedNumeric
Definition
safe_conversions_impl.h:489
v8::base::internal::StrictNumeric
Definition
safe_conversions_impl.h:493
v8::base::internal::operator<<
std::ostream & operator<<(std::ostream &os, const StrictNumeric< T > &value)
Definition
ostream_operators.h:26
v8::base::internal::StrictNumeric
StrictNumeric(T) -> StrictNumeric< T >
v8::base::internal::ClampedNumeric
ClampedNumeric(T) -> ClampedNumeric< T >
v8::base
Definition
scopes.h:26
v8::internal::internal
internal
Definition
wasm-objects-inl.h:458
src
base
numerics
ostream_operators.h
Generated on Sun Apr 6 2025 21:08:50 for v8 by
1.12.0