MCPcopy Create free account
hub / github.com/boostorg/parser / move_back_impl

Function move_back_impl

include/boost/parser/parser.hpp:2105–2147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2103
2104 template<typename Container, typename U>
2105 constexpr void move_back_impl(Container & c, U && x)
2106 {
2107 using just_t = range_value_t<Container>;
2108 using just_u = remove_cv_ref_t<U>;
2109 if constexpr (needs_transcoding_to_utf8<Container, U>) {
2110 char32_t cps[1] = {(char32_t)x};
2111 auto const r = cps | text::as_utf8;
2112 c.insert(c.end(), r.begin(), r.end());
2113 } else if constexpr (std::is_convertible_v<just_u &&, just_t>) {
2114 detail::insert(c, (U &&)x);
2115 } else if constexpr (
2116 !is_tuple<just_t>::value && is_tuple<just_u>::value &&
2117 std::is_aggregate_v<just_t> &&
2118 !is_detected_v<insertable, Container, just_u &&> &&
2119 is_struct_assignable_v<just_t, just_u>) {
2120 auto int_seq =
2121 std::make_integer_sequence<int, tuple_size_<just_u>>();
2122 detail::insert(
2123 c, detail::tuple_to_aggregate<just_t>((U &&)x, int_seq));
2124 } else if constexpr (
2125 is_tuple<just_t>::value && !is_tuple<just_u>::value &&
2126 std::is_aggregate_v<just_u> &&
2127 !is_detected_v<insertable, Container, just_u &&> &&
2128 is_tuple_assignable_v<just_t, just_u>) {
2129 just_t t;
2130 auto tie = detail::tie_aggregate(x);
2131 detail::aggregate_to_tuple(
2132 t,
2133 tie,
2134 std::make_integer_sequence<int, tuple_size_<just_t>>());
2135 detail::insert(c, std::move(t));
2136 } else if constexpr (is_constructible_from_tuple_v<
2137 just_t,
2138 just_u>) {
2139 detail::insert(c, detail::make_from_tuple<just_t>((U &&)x));
2140 } else {
2141 static_assert(
2142 sizeof(U) && false,
2143 "Could not insert value into container, by: just inserting "
2144 "it; doing tuple -> aggregate or aggregate -> tuple "
2145 "conversions; or tuple -> class type construction.");
2146 }
2147 }
2148
2149 template<typename Container, typename T>
2150 constexpr void move_back(Container & c, T && x, bool gen_attrs)

Callers 1

move_backFunction · 0.85

Calls 6

tie_aggregateFunction · 0.85
aggregate_to_tupleFunction · 0.85
insertFunction · 0.70
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected