Book Image

Learning Boost C++ Libraries

By : Arindam Mukherjee
Book Image

Learning Boost C++ Libraries

By: Arindam Mukherjee

Overview of this book

Table of Contents (19 chapters)
Learning Boost C++ Libraries
About the Author
About the Reviewers

Self-test questions

  1. The Rule of Three states that if you define your own destructor for a class, you should also define:

    a. Your own copy constructor

    b. Your own assignment operator

    c. Both a and b

    d. Either a or b

  2. Assuming the class String has both copy and move constructors, which of the following does not invoke a move constructor:

    a. String s1(getName());

    b. String s2(s1);

    c. String s2(std::move(s1));

    d. String s3("Hello");

  3. The purpose of std::move function is to:

    a. Move contents of its argument out

    b. Create an lvalue reference from an rvalue reference

    c. Create an xvalue from an lvalue expression

    d. Swap contents of its argument with another object

  4. In which of the following cases does Return Value Optimization apply?:

    a. return std::string("Hello");

    b. string reverse(string);string a, b;reverse(a + b);

    c. std::string s("Hello");return s;

    d. std::string a, b;return a + b.