Enumerations
enum class ParseErr : int
| Name | Value |
|---|---|
| empty | 1 |
| invalid | 2 |
| overflow | 3 |
价格字符串解析的可恢复错误码
Defined at line 31 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/ModernParadigm.hxx
Records
Functions
-
double compute_sqrt (double value)计算非负且不超过 kComputeSqrtMaxInput 的平方根。
Parameters
value 待开平方的输入Returns
sqrt(value);非法输入(负数 / 非有限 / 超上限)返回 -1.0
Defined at line 13 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/TutorialMath.cxx
-
std::expected<Price, ParseErr> parse_price_cents (std::string_view s)类型安全的解析:用 std::expected 表达错误(非 magic -1)。
Parameters
s 仅含 ASCII 数字的分字符串Returns
成功为 Price,失败为 ParseErr
Defined at line 14 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/ModernParadigm.cxx
-
bool operator== (Price , Price )Defined at line 21 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/ModernParadigm.hxx
-
bool has_numeric_argument (int argc)判断命令行是否提供了数值参数。
Parameters
argc main() 的参数个数Returns
argc >= 2 时为 true
Defined at line 21 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/TutorialMath.cxx
-
bool operator== (Quantity , Quantity )Defined at line 27 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/ModernParadigm.hxx
-
std::int64_t sum_cents (std::span<const Price> prices)对价格数组求和(std::span 零拷贝 API)
Defined at line 33 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/ModernParadigm.cxx
-
template <NamedValue T>std::int32_t raw_qty (T t)提取 NamedValue 的原始数量值
Defined at line 51 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/ModernParadigm.hxx
Concepts
template <class T> NamedValue requires (T t) { { t.value } -> std::convertible_to<std::int32_t>; }
Concept 演示:具名数值类型须暴露 .value 且可转为 int32
Defined at line 44 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/ModernParadigm.hxx
Variables
const double kComputeSqrtMaxInput
Defined at line 17 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/TutorialMath.hxx
T t
Defined at line 45 of file /Users/runner/work/CXX-CMake-template/CXX-CMake-template/single-exe-classic/src/ModernParadigm.hxx