阅读背景:

是否保证模板参数调用用户提供的演绎指南

来源:互联网 

Consider an example:

考虑一个例子:

#include <type_traits>
#include <string>

template <template <class> class TT> //#1
struct Foo {
   static void foo() {
      static_assert(std::is_same_v<decltype(TT("abc")), TT<std::string>>);
   }
};

template <class T>
struct Bar {
    Bar(T) {}
};

template <class T>
Bar(T) -> Bar<std::string>; //#2

int main() {
    Foo<Bar>::foo();
}
#include <type



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: