@@ -289,7 +289,7 @@ struct ExprSelect : Expr
289289 std::pmr::polymorphic_allocator<char > & alloc,
290290 const PosIdx & pos,
291291 Expr * e,
292- const std::span<const AttrName> & attrPath,
292+ std::span<const AttrName> attrPath,
293293 Expr * def)
294294 : pos(pos)
295295 , nAttrPath(attrPath.size())
@@ -339,7 +339,7 @@ struct ExprOpHasAttr : Expr
339339 Expr * e;
340340 std::span<AttrName> attrPath;
341341
342- ExprOpHasAttr (std::pmr::polymorphic_allocator<char > & alloc, Expr * e, const std::vector <AttrName> & attrPath)
342+ ExprOpHasAttr (std::pmr::polymorphic_allocator<char > & alloc, Expr * e, std::span <AttrName> attrPath)
343343 : e(e)
344344 , attrPath({alloc.allocate_object <AttrName>(attrPath.size ()), attrPath.size ()})
345345 {
@@ -433,7 +433,7 @@ struct ExprList : Expr
433433{
434434 std::span<Expr *> elems;
435435
436- ExprList (std::pmr::polymorphic_allocator<char > & alloc, const std::vector <Expr *> & exprs)
436+ ExprList (std::pmr::polymorphic_allocator<char > & alloc, std::span <Expr *> exprs)
437437 : elems({alloc.allocate_object <Expr *>(exprs.size ()), exprs.size ()})
438438 {
439439 std::ranges::copy (exprs, elems.begin ());
@@ -753,7 +753,19 @@ struct ExprConcatStrings : Expr
753753 std::pmr::polymorphic_allocator<char > & alloc,
754754 const PosIdx & pos,
755755 bool forceString,
756- const std::vector<std::pair<PosIdx, Expr *>> & es)
756+ std::span<std::pair<PosIdx, Expr *>> es)
757+ : pos(pos)
758+ , forceString(forceString)
759+ , es({alloc.allocate_object <std::pair<PosIdx, Expr *>>(es.size ()), es.size ()})
760+ {
761+ std::ranges::copy (es, this ->es .begin ());
762+ };
763+
764+ ExprConcatStrings (
765+ std::pmr::polymorphic_allocator<char > & alloc,
766+ const PosIdx & pos,
767+ bool forceString,
768+ std::initializer_list<std::pair<PosIdx, Expr *>> es)
757769 : pos(pos)
758770 , forceString(forceString)
759771 , es({alloc.allocate_object <std::pair<PosIdx, Expr *>>(es.size ()), es.size ()})
@@ -833,7 +845,19 @@ public:
833845 add (std::pmr::polymorphic_allocator<char > & alloc,
834846 const PosIdx & pos,
835847 bool forceString,
836- const std::vector<std::pair<PosIdx, Expr *>> & es)
848+ std::span<std::pair<PosIdx, Expr *>> es)
849+ requires (std::same_as<C, ExprConcatStrings>)
850+ {
851+ return alloc.new_object <C>(alloc, pos, forceString, es);
852+ }
853+
854+ template <class C >
855+ [[gnu::always_inline]]
856+ C *
857+ add (std::pmr::polymorphic_allocator<char > & alloc,
858+ const PosIdx & pos,
859+ bool forceString,
860+ std::initializer_list<std::pair<PosIdx, Expr *>> es)
837861 requires (std::same_as<C, ExprConcatStrings>)
838862 {
839863 return alloc.new_object <C>(alloc, pos, forceString, es);
0 commit comments