Remove some dead code and fix format output when to_chars gives a value other than 'nan' or 'inf'
This commit is contained in:
parent
dfa4202e55
commit
7ee0beb343
@ -30,7 +30,7 @@
|
|||||||
#include "parse.hpp"
|
#include "parse.hpp"
|
||||||
#include "utf_iterator.hpp"
|
#include "utf_iterator.hpp"
|
||||||
|
|
||||||
#include "../../utility.hpp" //abs
|
#include "../../utility.hpp" //abs, memcpy
|
||||||
|
|
||||||
#include <type_traits> //remove_cvref
|
#include <type_traits> //remove_cvref
|
||||||
#include <utility> //forward, move
|
#include <utility> //forward, move
|
||||||
@ -537,7 +537,14 @@ namespace rexy::fmt::detail{
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if(manual_precision){
|
//manually handle nan and inf since some compilers (msvc) output something other than the desired values in 'to_chars'
|
||||||
|
if(is_nan){
|
||||||
|
result.ptr = buffstart + 3;
|
||||||
|
rexy::memcpy(buffstart, "nan", 3);
|
||||||
|
}else if(is_infinity){
|
||||||
|
result.ptr = buffstart + 3;
|
||||||
|
rexy::memcpy(buffstart, "inf", 3);
|
||||||
|
}else if(manual_precision){
|
||||||
const int precision = supplied_precision ? specs.precision : 6;
|
const int precision = supplied_precision ? specs.precision : 6;
|
||||||
result = std::to_chars(buffstart, buffend, f, fmt, precision);
|
result = std::to_chars(buffstart, buffend, f, fmt, precision);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@ -114,6 +114,7 @@ namespace rexy::fmt::detail{
|
|||||||
if(written != this->m_size){
|
if(written != this->m_size){
|
||||||
REXY_THROW_FORMAT_ERROR("Failed to print data");
|
REXY_THROW_FORMAT_ERROR("Failed to print data");
|
||||||
}
|
}
|
||||||
|
return written;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -80,8 +80,8 @@ namespace rexy::fmt::detail::parse{
|
|||||||
return static_cast<long long>(t);
|
return static_cast<long long>(t);
|
||||||
}else{
|
}else{
|
||||||
REXY_THROW_FORMAT_ERROR("Invalid dynamic specifier");
|
REXY_THROW_FORMAT_ERROR("Invalid dynamic specifier");
|
||||||
return static_cast<long long>(0);
|
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
template<class Specs>
|
template<class Specs>
|
||||||
constexpr decltype(auto) dynamic_width_adapter<Specs>::operator()(void){
|
constexpr decltype(auto) dynamic_width_adapter<Specs>::operator()(void){
|
||||||
@ -182,7 +182,6 @@ namespace rexy::fmt::detail::parse{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return last;
|
return last;
|
||||||
REXY_THROW_FORMAT_ERROR("Invalid index spec");
|
|
||||||
}
|
}
|
||||||
for(auto it = start+1;it != last;++it){
|
for(auto it = start+1;it != last;++it){
|
||||||
if(!is_a_number(*it)){
|
if(!is_a_number(*it)){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user