2
0
mirror of https://github.com/boostorg/parser.git synced 2026-01-19 04:22:13 +00:00

Add missing optional<Container> overloads of detail::append.

This commit is contained in:
Zach Laine
2024-03-09 17:28:57 -06:00
parent 3ff6a575ad
commit 2fa916530e

View File

@@ -370,6 +370,7 @@ namespace boost { namespace parser {
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
template<typename T>
using print_type = typename print_t<T>::type;
@@ -1322,6 +1323,16 @@ namespace boost { namespace parser {
}
}
template<typename Container, typename T>
void append(std::optional<Container> & c, T && x, bool gen_attrs)
{
if (!gen_attrs)
return;
if (!c)
c = Container();
return detail::append(*c, (T &&) x, gen_attrs);
}
template<typename Container>
void append(Container & c, nope &&, bool)
{}
@@ -1348,6 +1359,20 @@ namespace boost { namespace parser {
}
}
template<typename Container, typename Iter, typename Sentinel>
void append(
std::optional<Container> & 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<typename Iter, typename Sentinel>
void append(nope &, Iter first, Sentinel last, bool gen_attrs)
{}