I'm using curiously recurring template pattern for creating shared pointer in the following way (below). On Derived::create(...) Visual Studio IntelliSense shows than available arguments are (Args &&...args). How to pass Derived class constructor argument list to Base so that IntelliSense would show me that available arguments are (const std::string &str, int i)?
#include <memory>
#include <string>
template<typename T>
class Base
{
public:
template<typename... Args >
static std::shared_ptr<T> create(Args&&... args)
{
return std::make_shared<T>(std::forward<Args>(args)...);
}
};
class Derived : public Base<Derived>
{
public:
Derived(const std::string &str, int i) {}
};
int main()
{
auto derived = Derived::create("text", 123);
}
make_sharedto figure that out).