Date: Sat, 20 Jul 2019 21:15:54 +0100
Hello
Could std::string to_string(bool value); be added? Currently it outputs
as a number due to the implicit conversion to int?
Feel it would have been more appropriate as "true" or "false".
http://www.cplusplus.com/reference/string/to_string/
$ g++-8 -Wall -o to_string to_string.cpp
$ ./to_string
1
// g++-8 -Wall -o to_string to_string.cpp
#include <string>
#include <iostream>
int main()
{
const bool a = true;
const std::string b(std::to_string(a));
std::cout << b << std::endl;
}
Cheers, Jonny
.
Could std::string to_string(bool value); be added? Currently it outputs
as a number due to the implicit conversion to int?
Feel it would have been more appropriate as "true" or "false".
http://www.cplusplus.com/reference/string/to_string/
$ g++-8 -Wall -o to_string to_string.cpp
$ ./to_string
1
// g++-8 -Wall -o to_string to_string.cpp
#include <string>
#include <iostream>
int main()
{
const bool a = true;
const std::string b(std::to_string(a));
std::cout << b << std::endl;
}
Cheers, Jonny
.
Received on 2019-07-20 15:17:52