Add double constructor for Version
This commit is contained in:
@@ -178,4 +178,20 @@ namespace OpenVulkano
|
||||
return CompareTimestamp(other);
|
||||
}
|
||||
//endregion
|
||||
|
||||
namespace
|
||||
{
|
||||
uint32_t GetDigits(double val)
|
||||
{
|
||||
if (val == 0) return 0;
|
||||
std::string fracStr = std::to_string(val);
|
||||
fracStr.erase(fracStr.find_last_not_of('0') + 1, std::string::npos);
|
||||
fracStr.erase(0, fracStr.find_first_of('.') + 1);
|
||||
return std::stoul(fracStr);
|
||||
}
|
||||
}
|
||||
|
||||
Version::Version(double version)
|
||||
: Version(static_cast<uint32_t>(version), GetDigits(version))
|
||||
{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user