Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
function template
:
Content language: Русский
English
Корректен ли такой код? template <template<class T> class TT> void f() { }
function template
Какие из объявлений шаблона функции верны?
function template
Какой из приведенных ниже вариантов подходит больше всего? #include <iostream> //... // 1 inline int const& max(int const& a, int const& b) { return a < b ? b : a; } // 2 template<typename T> inline T const& max (T const& a, T const& b) { return a < b ? b : a; } //... int main() { //... std::cout << ::max('a', 42.7) << std::endl; //3 //... return 0; }
function template
Содержит ли следующий код ошибки (компиляции, выполнения, линковки, UB): template <int T> void f(); template <> void f<0>() {} void Test() { f<1>(); }
function template
Что выведет на консоль следующий код? #include <iostream> template<int T> int TempFunc() { return 1 + TempFunc<T & (T-1)>(); } template<> int TempFunc<0>() { return 0; } int main() { std::cout << TempFunc<13>() << TempFunc<5>(); }
function template
Что будет выведено в консоль (C++11)? #include <iostream> template<typename T1, typename T2> auto func(T1 a, T2 b) -> decltype(a>b?b:a) { return a>b?b:a; } int main() { int a = 3; double b = 5; std::cout << func(a,b)/2; return 0; }
function template
Имеется шаблонная функция template <class T> T max (T a, T b) { if a<b return b; return a; } Какая специализация будет создана компилятором при вызове max( 'a' , 3 ) ?
function template
Что выведет эта программа: #include <iostream> #include <map> template<class T> void f(std::map<int, T>::value_type& v) { std::cout << v.first << v.second << std::endl; } int main() { std::map<int, int> m; m[0] = 2; f<int>(*m.begin()); return 0; }
function template
Могут ли динамические библиотеки экспортировать шаблонные функции и классы:
function template
Отметьте корректные способы вызова функций: vоid f(int,int); tеmрlаtе<сlаss Т> vоid f(Т,Т=Т());
function template
← Prev
1
2
3
Next →
Sign Up Now
or
Subscribe for future quizzes