Use std versions of sized types

This fixes some stricter warnings and includes arising in gcc-13 and
clang-16
This commit is contained in:
Danny Robson 2023-05-15 10:33:23 +10:00
parent 867d768108
commit 3e480c7bbb
2 changed files with 13 additions and 10 deletions

View File

@ -7,6 +7,7 @@
*/ */
#include "stats.hpp" #include "stats.hpp"
#include "std.hpp"
#include <limits> #include <limits>
#include <ostream> #include <ostream>
@ -61,7 +62,7 @@ cruft::stats::accumulator<T>::mean (void) const
{ return sum / count; } { return sum / count; }
template struct cruft::stats::accumulator<uint64_t>; template struct cruft::stats::accumulator<u64>;
template struct cruft::stats::accumulator<double>; template struct cruft::stats::accumulator<double>;
template struct cruft::stats::accumulator<float>; template struct cruft::stats::accumulator<float>;
@ -74,7 +75,7 @@ cruft::stats::operator<< (std::ostream &os, const accumulator<T> &rhs) {
} }
template std::ostream& cruft::stats::operator<< (std::ostream&, const accumulator<uint64_t> &); template std::ostream& cruft::stats::operator<< (std::ostream&, const accumulator<u64> &);
template std::ostream& cruft::stats::operator<< (std::ostream&, const accumulator<double> &); template std::ostream& cruft::stats::operator<< (std::ostream&, const accumulator<double> &);
template std::ostream& cruft::stats::operator<< (std::ostream&, const accumulator<float > &); template std::ostream& cruft::stats::operator<< (std::ostream&, const accumulator<float > &);

View File

@ -8,6 +8,8 @@
#include "string.hpp" #include "string.hpp"
#include <cstdint>
#define do_type_to_string(T) \ #define do_type_to_string(T) \
template <> std::string type_to_string <T> (void) { return #T; } \ template <> std::string type_to_string <T> (void) { return #T; } \
template <> std::string type_to_string <const T> (void) { return "const " #T; } template <> std::string type_to_string <const T> (void) { return "const " #T; }
@ -15,13 +17,13 @@ template <> std::string type_to_string <const T> (void) { return "const " #T; }
do_type_to_string (float) do_type_to_string (float)
do_type_to_string (double) do_type_to_string (double)
do_type_to_string ( int8_t) do_type_to_string (std:: int8_t)
do_type_to_string ( int16_t) do_type_to_string (std:: int16_t)
do_type_to_string ( int32_t) do_type_to_string (std:: int32_t)
do_type_to_string ( int64_t) do_type_to_string (std:: int64_t)
do_type_to_string ( uint8_t) do_type_to_string (std:: uint8_t)
do_type_to_string (uint16_t) do_type_to_string (std::uint16_t)
do_type_to_string (uint32_t) do_type_to_string (std::uint32_t)
do_type_to_string (uint64_t) do_type_to_string (std::uint64_t)