CNL
2.0.2 (development)
Compositional Numeric Library
to_string.h
1
2
// Copyright John McFarlane 2018.
3
// Distributed under the Boost Software License, Version 1.0.
4
// (See accompanying file ../LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
7
#if !defined(CNL_IMPL_SCALED_INTEGER_TO_STRING_H)
8
#define CNL_IMPL_SCALED_INTEGER_TO_STRING_H
9
10
#include "../../integer.h"
11
#include "../scaled/is_scaled_tag.h"
12
#include "definition.h"
13
#include "to_chars.h"
14
15
#include <string>
16
18
namespace
cnl
{
19
using
std::to_string
;
20
21
template
<
int
eger Rep, scaled_tag Scale>
22
auto
to_string
(
cnl::scaled_integer<Rep, Scale>
const
& value)
23
{
24
auto
const
[chars, length] = to_chars_static(value);
25
return
std::string
{chars.
data
(), unsigned(length)};
26
}
27
}
28
29
#endif // CNL_IMPL_SCALED_INTEGER_TO_STRING_H
std::string
STL class.
std::to_string
T to_string(T... args)
cnl
compositional numeric library
Definition:
abort.h:15
cnl::scaled_integer
_impl::wrapper< Rep, Scale > scaled_integer
literal real number approximation that uses fixed-point arithmetic
Definition:
definition.h:52
std::string::data
T data(T... args)
cnl
_impl
scaled_integer
to_string.h
Generated by
1.8.17