From 2fa916530ecf2fc96b55cb8477b623959ac21933 Mon Sep 17 00:00:00 2001 From: Zach Laine Date: Sat, 9 Mar 2024 17:28:57 -0600 Subject: [PATCH] Add missing optional overloads of detail::append. --- include/boost/parser/parser.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/boost/parser/parser.hpp b/include/boost/parser/parser.hpp index 51076a43..0e4e73c3 100644 --- a/include/boost/parser/parser.hpp +++ b/include/boost/parser/parser.hpp @@ -370,6 +370,7 @@ namespace boost { namespace parser { #if defined(_MSC_VER) #pragma warning(pop) #endif + template using print_type = typename print_t::type; @@ -1322,6 +1323,16 @@ namespace boost { namespace parser { } } + template + void append(std::optional & c, T && x, bool gen_attrs) + { + if (!gen_attrs) + return; + if (!c) + c = Container(); + return detail::append(*c, (T &&) x, gen_attrs); + } + template void append(Container & c, nope &&, bool) {} @@ -1348,6 +1359,20 @@ namespace boost { namespace parser { } } + template + void append( + std::optional & c, + Iter first, + Sentinel last, + bool gen_attrs) + { + if (!gen_attrs) + return; + if (!c) + c = Container(); + return detail::append(*c, first, last, gen_attrs); + } + template void append(nope &, Iter first, Sentinel last, bool gen_attrs) {}