c++: std::to_string is available in C++11

Reported by Victor Khomenko.
http://lists.gnu.org/archive/html/bug-bison/2018-10/msg00033.html

* doc/bison.texi, examples/c++/variant-11.yy: Use std::to_string
instead of ours.
This commit is contained in:
Akim Demaille
2018-10-24 18:49:04 +02:00
parent 8fd5f0d5a5
commit 5b879c8980
2 changed files with 23 additions and 53 deletions

View File

@@ -69,16 +69,6 @@
// std::make_unique is C++14.
return string_uptr (new std::string{std::forward<Args> (args)...});
}
// Convert to string.
template <typename T>
std::string
to_string (const T& t)
{
auto&& o = std::ostringstream{};
o << t;
return o.str ();
}
}
%token <string_uptr> TEXT;
@@ -103,7 +93,7 @@ list:
item:
TEXT
| NUMBER { $$ = make_string_uptr (to_string ($1)); }
| NUMBER { $$ = make_string_uptr (std::to_string ($1)); }
;
%%