Variadic template templates and perfect forwarding

前端 未结 3 1033
北恋
北恋 2020-12-07 16:24

This question on the object generator pattern got me thinking about ways to automate it.

Essentially, I want to automate the creation of functions like std::ma

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-07 17:14

    This is probably a GCC quirk. I can get the following to work with a dev snapshot (I don't have a copy of 4.6 right now):

    template<
        template class TemplateClass
        , typename... Args
    
        , typename Result = TemplateClass
        // Also works with the arguably more correct
        // , typename Result = TemplateClass<
        //     typename std::decay::type...
        // >
    >
    Result
    make(Args&&... args)
    { /* as before */ }
    

提交回复
热议问题