#include <boost/any.hpp>
#include <memory>
#include <iostream>
Go to the source code of this file.
Enumerator |
---|
notdfp |
|
eos |
|
restart |
|
Definition at line 16 of file test_any.cxx.
Definition at line 18 of file test_any.cxx.
22 aobj = std::make_shared<Foo>();
24 auto base = boost::any_cast<std::shared_ptr<Foo> >(aobj);
27 cerr <<
"base is null\n";
30 cerr <<
"base is not null\n";
33 boost::any what =
eos;
34 if (
eos == boost::any_cast<DFPMeta>(what)) {
35 cerr <<
"Got eos from eos\n";
40 dfpm = boost::any_cast<
DFPMeta>(aobj);
42 catch (boost::bad_any_cast &
e) {
43 std::cerr <<
"aobj not a DFPMeta: " << e.what() <<
'\n';
46 cerr <<
"DFPMeta = " << dfpm <<
"\n";