templates

    0熱度

    3回答

    做完從GCC下面的錯誤代碼的簡要搜索,命中數顯示的問題,要求對這一問題的幫助,但沒有什麼具體的輪番上漲: error: explicit specialization of non-template 'std::hash' 它看起來像std :: hash確實是一個模板,所以錯誤不清楚問題是什麼。下面是生成消息的示例代碼。 GCC選項-std = C++ 0x編譯代碼就好了。問題是我有一個較舊的編

    23熱度

    5回答

    爲什麼這不與gcc48和clang32編譯? #include <type_traits> template <int N> struct S { template<class T> typename std::enable_if<N==1, int>::type f(T t) {return 1;}; template<class T>

    12熱度

    2回答

    最小程序: #include <stdio.h> #include <type_traits> template<typename S, typename T> int foo(typename T::type s) { return 1; } template<typename S, typename T> int foo(S s) { return 2;

    0熱度

    1回答

    decltype的結果是否與模板標識符相同? (當談到T及其價值時,什麼是正確的術語?)。那是否存在斷言失敗的情況? template<typename T> void foo(T x) { static_assert(std::is_same<decltype(x), T>::value, "decltype check failed"); }

    3熱度

    1回答

    是否可以將is_const表達式轉換爲test函數,或者這是不可能的,因爲頂級cv-qualifieres在模板類型推理期間被忽略? int main() { using std::is_const; const int x = 0; int y = 0; // move to "bool test()" std::cout <<

    2熱度

    1回答

    說我有: template < typename T > class ClassA { void doTheStuff (T const * t); }; template < typename T > class ClassB { // Some stuff... }; 我想專門的doTheStuff方法是這樣的ClassB的模板的所有實例: templa

    2熱度

    2回答

    當你有一個類型依賴於某些約束的成員時,你如何設計多態。 說我有這樣的: template<typename T> class Base { public: Base() = default; virtual ~Base() = default; T member; }; class DerivedA : public Base<int> { publi

    1熱度

    1回答

    我正在尋找輕巧的PHP框架(沒有複雜的架構,mvc/mvvm等)和smarty支持。 但我也想友好的網址。例如,請求http://www.myhost.com/somepage應加載smarty-template somepage.tpl。有一些標準的解決方案嗎?

    1熱度

    1回答

    我試圖避免冗餘,並調用通用XTemplate格式化時間戳中的日期和時間。 這不會輸出我期望的字符串,只是UI中的[Object object]。 SCB.RMWB.templates = { timeStamp: function(stamp) { return new Ext.XTemplate( '<span class="time-frame">{[ th

    6熱度

    1回答

    我用gcc/4.7,我需要實例化的模板函數(或成員函數)的模板,模板參數的類。我收到以下錯誤 test.cpp: In function 'void setup(Pattern_Type&)': test.cpp:17:34: error: type/value mismatch at argument 1 in template parameter list for 'template<tem