mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +00:00
std::stod replaced to std::from_chars
This commit is contained in:
parent
1f11fa8fea
commit
ece68e715d
1 changed files with 4 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
#include "xml.h"
|
#include "xml.h"
|
||||||
|
|
||||||
|
#include <charconv>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "../util/stringutil.h"
|
#include "../util/stringutil.h"
|
||||||
|
|
@ -24,7 +25,9 @@ int64_t Attribute::asInt() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
double Attribute::asFloat() const {
|
double Attribute::asFloat() const {
|
||||||
return std::stod(text);
|
double value;
|
||||||
|
std::from_chars(text.data(), text.data()+text.size(), value);
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Attribute::asBool() const {
|
bool Attribute::asBool() const {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue