You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7896632
Browse filesBrowse the repository at this point in the historyBrowse files
Add support for rules that receive argument packs (#416)
Add support for rules like `std::vector<T1>::emplace_back(Args&&....)`
and `std::unique_ptr<T>::make_unique(Args&&...)`. This also deletes the
emplace back plugin.
This sets the stage for adding other argument pack rules like
`std::construct_at` or `std::map::try_emplace`.
Rust does not support forwarding argument packs. So emplace_back is
translated as `v.push(T::new(arg1, arg2, ...))`, i.e. it builds the
object at the call site. For things that might not build the object
using the provided arguments, like try_emplace, we will use the
following translation that conditionally builds the object:
`m.entry(key).or_insert_with(|| T::new(arg1, arg2, ...))`.
I used a new node in Rules IR, called init, which rule-preprocessor
creates when encountering a pack that builds an object. cpp2rust reads
the init node and creates a construct expression which is then
translated in order to create `T::new(arg1, arg2, ...)`.
0 commit comments