std::boolalpha is already available:
int main(){bool const a = true;std::cout << std::boolalpha << a << std::endl;}
My gut instinct here is that one is supposed to control how one wants data to be printed out, in the same way as how float/double precision is done.
On Sat, 20 Jul 2019, 21:16 Jonny Grant via Std-Proposals, <std-proposals@lists.isocpp.org> wrote:
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
.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals