cpdocs-basic-example API documentation
Project documentation Docs

File: src/math.cpp

1// --------------------------------------------------------------------------------------------------2// SPDX-License-Identifier: Apache-2.03// SPDX-FileCopyrightText: 2026 cpdocs developers4// --------------------------------------------------------------------------------------------------5#include <acme/math.hpp>6 7namespace acme {8 9int add(int left, int right) noexcept { return left + right; }10 11division_result divide(double numerator, double denominator) noexcept {12    if (denominator == 0.0) {13        return {0.0, false};14    }15    return {numerator / denominator, true};16}17 18std::string_view to_string(status value) noexcept {19    return value == status::ok ? "ok" : "invalid";20}21 22std::string_view to_string(bool value) noexcept { return value ? "true" : "false"; }23 24} // namespace acme