К каким последствиям приведёт использование ключевого слова extern при описании переменной, находящейся внутри тела функции?
<pre> //====================== start of sample.cpp ========================== #include <type_traits > class A { public: A(int in = 5); }; int main() { std::is_pointer<A> is_ptr; return 0; } //====================== end of sample.cpp ========================== </pre> Как может использоваться объявление переменной is_ptr?
В чём ограничены массивы переменной длины?
К какой характеристике класса памяти относится следующее определение: "откуда, из каких точек мы можем обратиться к этой переменной по её имени"?
К какой характеристике класса памяти относится следующее определение: "насколько долго участок памяти, будет занят соответствующей переменной"?
<pre> //====================== start of sample.cpp ========================== #include <stdexcept> void my_open1() { throw int(8); } void my_open2() try { throw std::logic_error(""); } catch(std::runtime_error& err) {} void my_open3() try { throw std::runtime_error(&guot;runtime"); } catch(const std::runtime_error* err) {} struct ERR_ {}; void my_open4() { try { throw ERR_(); } catch(...) {} } int main() { try { } catch(...) { return 5; } return 0; } //====================== end of sample.cpp ========================== </pre> Вызов каких из функций изнутри блока try в функции main() приведёт к завершению программы с результатом 5?
<pre> //====================== start of sample.cpp ========================== int main(int argc, char* argv[]) { int a = 0; int b = 0; int X = 0; auto lf1 = [a,b,X] (int x) {return x > 0;}; auto lf2 = [a,b] (int x) { x++; return x;}; auto lf3 = [=] (int x) { x++; return x;}; auto lf4 = [&] (int x) { x++; return x;}; auto lf5 = [] (bool& z) { z = !z; return;}; return 0; } //====================== end of sample.cpp ========================== </pre> Какие лямбда функции из примера выше имеют доступ к значению переменной X?
<pre> //====================== start of sample.cpp ========================== template<unsigned long N> class binary { public: static unsigned long const value = binary<N / 10>::value << 1 | N % 10; }; template<> class binary<0> { public: static unsigned long const value = 0; }; int main(int argc, char* argv[]) { if (argc > 1) { static unsigned const two = binary<10>::value; } return 0; } //====================== end of sample.cpp ========================== </pre> Когда будет посчитано значение переменной two?
<pre> //====================== start of sample.cpp ========================== template<unsigned long N> class binary { public: static unsigned long const value = binary<N / 10>::value << 1 | N % 10; }; template<> class binary<0> { public: static unsigned long const value = 0; }; template<> class binary<1> { public: static unsigned long const value = 1; }; int main(int argc, char* argv[]) { static unsigned const x0 = binary<0>::value; static unsigned const x1 = binary<1000>::value; static unsigned const x2 = binary<1001>::value; static unsigned const x3 = binary<1010>::value; static unsigned const x4 = binary<1011>::value; return 0; } //====================== end of sample.cpp ========================== </pre> При инициализации какой переменной не будет использоваться конкретизация шаблона с параметром 0?
<pre>//====================== start of sample.cpp ========================== class Input { public: Input(); ~Input(); virtual void f(); }; class ManualUserDev: public Input { public: ManualUserDev(); virtual ~ManualUserDev(); }; class Keyboard: public Input { public: Keyboard(); ~Keyboard(); }; int main() { Keyboard keyboard; Input& rinp = keyboard; Input* pinp = &:keyboard; ManualUserDev& rmy_mdev = dynamic_cast<ManualUserDev&>(rinp); ManualUserDev* pmy_mdev = dynamic_cast<ManualUserDev*>(pinp); Keyboard& rmy_keyboard = dynamic_cast<Keyboard&>(rinp); Keyboard* pmy_keyboard = dynamic_cast<Keyboard*>(pinp); return 0; }//====================== end of sample.cpp ========================== </pre> При инициализации какой переменной в файле sample.cpp будет брошено исключение?