- Learning Boost C++ Libraries
- Arindam Mukherjee
- 345字
- 2021-07-16 20:49:02
Self-test questions
For multiple choice questions, choose all the options that apply:
- What are the advantages of using
boost::swap
overstd::swap
?a. There is no real advantage
b.
boost::swap
invokes swap overloads supplied with the passed type, if anyc.
boost::swap
is faster thanstd::swap
d.
boost::swap
does not throw exceptions - Can you apply a visitor to multiple variant arguments in a single call? (Hint: you may want to look up the online documentation)
a. Yes. A visitor can only be applied to one or two variant arguments
b. Yes. A visitor can be applied to one or more arguments
c. No. The member operators take only one variant argument
d. None of the above
- Is the following a valid compile-time assert?
BOOST_STATIC_ASSERT(x == 0); // x is some variable
a. Yes, provided
x
is of an integral typeb. Yes, provided
x
is declared as aconst static
numeric variablec. No,
x
is a variable, and its value cannot be known at compile timed. Only expressions involving
sizeof
are valid in aBOOST_STATIC_ASSERT
- What do we mean when we say that a type
X
is a POD type?a.
X
does not have a user-defined constructor or destructorb.
X
can be copied by copying its memory layout bit-wisec.
X
does not have a user-defined copy constructor or copy assignment operatord. All of the above
- What is the type and value stored in a default-constructed object of type
boost::variant<std::string, double>
?a. The type is
const char*
and value isNULL
b. The type is
double
and value is0.0
c. The type is
std::string
and value is the default constructedstd::string
d. The type is
boost::optional<double>
and value is empty - Check the reference on Boost.Optional in the online documentation for the latest Boost libraries. What happens if you call the
get
andget_ptr
methods on an emptyoptional
object?a. Both throw the
boost::empty_optional
exceptionb.
get
throws an exception, whileget_ptr
returns a null pointerc.
get
asserts, whileget_ptr
returns a null pointerd. Both
get
andget_ptr
assert
- Google Apps Script for Beginners
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- Mastering Rust
- Java系統(tǒng)化項(xiàng)目開發(fā)教程
- ASP.NET求職寶典
- 黑莓(BlackBerry)開發(fā)從入門到精通
- SAP Web Dynpro for ABAP開發(fā)技術(shù)詳解:基礎(chǔ)應(yīng)用
- Python第三方庫開發(fā)應(yīng)用實(shí)戰(zhàn)
- SQL Server實(shí)例教程(2008版)
- Puppet 5 Beginner's Guide(Third Edition)
- 計(jì)算機(jī)視覺實(shí)戰(zhàn):基于TensorFlow 2
- IBM Cognos TM1 Cookbook
- Learning Network Programming with Java
- Natural Language Processing with Java Cookbook
- INSTANT Eclipse Application Testing How-to