c++: prefer 'emplace' to 'build'

When we introduced variants in Bison, C++ did not have the 'emplace'
functions, and we chose 'build'.  Let's align with modern C++ and
promote 'emplace' rather than 'build'.

* data/lalr1.cc, data/variant.hh (emplace): New.
(build): Deprecate in favor of emplace.
* doc/bison.texi: Adjust.
This commit is contained in:
Akim Demaille
2018-10-20 10:32:27 +02:00
parent e7b709ab0b
commit 42f0b949ec
3 changed files with 30 additions and 12 deletions

View File

@@ -862,7 +862,7 @@ b4_dollar_popdef])[]dnl
/* Variants are always initialized to an empty instance of the
correct type. The default '$$ = $1' action is NOT applied
when using variants. */
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [build])], [
b4_symbol_variant([[yyr1_@{yyn@}]], [yylhs.value], [emplace])], [
/* If YYLEN is nonzero, implement the default value of the
action: '$$ = $1'. Otherwise, use the top of the stack.