C++
The parame ...
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
The parameter of the template can be:
Any type except local and unnamed
Values of enumerated type
The value of any built-in type, except pointers and string constants
Any data type except those for which the default constructor is not defined
Explanation
Get an explanation when it's available:
Subscribe
template
type parameter
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Как правильно объявить метод добавления объекта типа ItemType в шаблон Container вида: template<class ItemType> class Container { /* ... */ };
Корректен ли такой код? template <template<class T> class TT> void f() { }
Какие из объявлений шаблонов верны?
Что будет выведено в результате выполнения кода: #include <iostream> struct A { struct B { int value; } b; }; template<typename T> void func(typename T::B b) { std::cout << b.value; } int main(int argc, char * argv[]) { A a = {{5}}; func(a.b); }
Что будет выведено в результате выполнения данной программы: template<class T, class U> struct A{ struct dummy{char _[2];}; static char _(T); static dummy _(...); static const bool value=sizeof(_(U()))==sizeof(char); }; struct B{}; struct C:B{}; ... cout << A<B,C>::value << A<B,B>::value << A<C,B>::value;
В каких строчках кода содержится ошибка? #include <iostream> using namespace std; template <class X, class Y> void f(X,Y) { cout<<"Ok"<<endl; } void main(void) { f(1,1); //1 f<int ,int>('c', 1); //2 f<string>("str",1.1); //3 }
C
++
Quiz
Login to learn C++
or
Read more about
C++ Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
C++ quizzes
int main() { const int* i = int(); // 1 int const* j = int(); //2 int* const k = int(); //3 int* l(); //4 ++i; //5 ++j; //6 ++k; //7 ++*k; //8 ++l; //9 } Откомпилируется ли такой код? Если нет, то в каких строчках будут ошибки компиляции? После стандарта C++14.
Какой результат работы программы? #include <iostream> using namespace std; void f(double) { cout<<"f1"<<endl; } void f(const int ) { cout<<"f2"<<endl; } void f( int & ) { cout<<"f3"<<endl; } void main(void) { int n = 1; double b = 2; f(n); f(b); }
#include <iostream> using namespace std; int &test() { static int a = 3; return a; } int main() { ++++++test(); cout << test() << endl; return 0; } Что выведет cout?
При истинности какого из приведенных высказываний имеет смысл вычитание указателей?
Какое ключевое слово используется для описания пространства имен?
В чем разница между X x; и X x(); ?
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment