CaptureMoment 0.1.0
Free and open-source non-destructive photo editor
Loading...
Searching...
No Matches
to_string_utils.h
Go to the documentation of this file.
1
9 #pragma once
10
11#include <string>
12#include <concepts> // For std::integral, std::floating_point
13
14namespace CaptureMoment::Core {
15
16namespace utils {
17
23template<typename T>
24concept ToStringablePrimitive = (std::integral<T> || std::floating_point<T>) &&
25 (!std::same_as<T, bool>);
26
37template<ToStringablePrimitive T>
38[[nodiscard]] std::string toString(T value) {
39 return std::to_string(value);
40}
41
51[[nodiscard]] inline std::string toString(bool value) {
52 return value ? "true" : "false";
53}
54
64[[nodiscard]] inline std::string toString(const std::string& value) {
65 return value;
66}
67
68} // namespace utils
69
70} // namespace CaptureMoment::Core
Concept defining types that can be converted to string using std::to_string. This includes integral t...
std::string toString(T value)
Converts a primitive value (integral or floating-point) to its string representation.
Manages the lifecycle of a single IWorkingImage instance.
CaptureMoment — footer