Bug 2943

Summary: Simplify the implementation of ns3::Create
Product: ns-3 Reporter: Matthew Bradbury <matt-bradbury>
Component: coreAssignee: Peter Barnes <pdbarnes>
Status: NEW ---    
Severity: enhancement CC: ns-bugs
Priority: P3    
Version: ns-3-dev   
Hardware: All   
OS: All   
Attachments: Patch to simplify ns3::Create

Description Matthew Bradbury 2018-07-06 11:26:31 EDT
Created attachment 3125 [details]
Patch to simplify ns3::Create

This patch simplifies the implementation of ns3::Create by using variadic templates and perfect forwarding. There are three main advantages:
(1) An arbitrary number of parameters can be passed to the constructor of T without needing to manually specify the overloads
(2) Copying the parameters can be potentially avoided
(3) The documentation of Create is simplified as there is only one entry present for it

This implementation is very similar to that of std::make_unique [1].

[1] https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique#Possible_Implementation