C ++ 17自动模板方法尾随返回类型声明+定义

时间:2019-06-29 22:24:40

标签: c++ templates return auto trailing

我可能没有正确的选择。在我看来,(通过设计?)模板方法无法像“常规”方法声明和定义那样被声明(在.hpp文件中)和实现(在.cpp文件中)?

换句话说,我想在.hpp文件中声明:

Product:Perform Action:Preprocess "..."

,并在.cpp文件中包含实现:

    template <class F, class... AL>
    auto push(F&& function, AL&& ... args) -> std::future<decltype(function(args...))>;

不可能,因为编译器需要在实际开始使用模板进行编译之前就知道模板的行为,对吗?

0 个答案:

没有答案