2016-04-13 44 views

回答

5

鑑於瑣碎的概念定義:

template <class T> concept bool C = true; 

我們可以聲明相同的函數模板f爲:

template <class T> requires C<T> void f(T); 
template <class T> void f(T) requires C<T>; 
template <C T> void f(T); // colloquially known as "terse" syntax 
C{T} void f(T); // template introduction syntax 
void f(C); // abbreviated function template syntax 
+0

我理解所有5個例,但到底是什麼模板概念布爾C =真;意思? – NoSenseEtAl

+0

它是可變模板嗎?又名有史以來最簡單的概念:對於每種類型它都是真實的? – NoSenseEtAl

+1

這是一個總是滿足一個類型參數的變量概念「C」的定義。 – Casey