ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
parse_number.hpp File Reference
#include <charconv>
#include <cstddef>
#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#include <system_error>
Include dependency graph for parse_number.hpp:

Go to the source code of this file.

Namespaces

namespace  reusex
namespace  reusex::utils

Functions

template<typename T>
std::optional< T > reusex::utils::parse_number (std::string_view s, std::size_t *consumed=nullptr)
 Parse a number at the start of s, after optional whitespace and a '+' (strtod accepts both; from_chars does not).
double reusex::utils::to_double (std::string_view s, std::size_t *pos=nullptr)
 std::stod's contract without its locale: throws std::invalid_argument when s does not start with a number; pos gets the characters used.
float reusex::utils::to_float (std::string_view s, std::size_t *pos=nullptr)
 std::stof's contract without its locale.