Subject: [Boost-bugs] [Boost C++ Libraries] #5768: any_cast
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-10 12:21:09
#5768: any_cast
-----------------------------------+----------------------------------------
Reporter: a.khawaldeh@⦠| Owner: nasonov
Type: Bugs | Status: new
Milestone: To Be Determined | Component: any
Version: Boost 1.47.0 | Severity: Problem
Keywords: |
-----------------------------------+----------------------------------------
assume we have a class Base, and other class Derived that inherits Base.
I can write
{{{
boost::any a = new Derived;
}}}
so, the following code
{{{
Derived* d = any_cast<Derived*>(a);
}}}
will work good, but!!
{{{
Base* b = any_cast<Base*>(a);
}}}
will fail.
i.e boost::any_cast could not work with inheritance and polymorphism.
You may wonder why this is needed? but I did faced this case.
I solved this problem in '''boost::any''' on my machine, and I thought to
share this with others, so if this sounds useful to you, please tell me
how can I add my code to boost
many thanks.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5768> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC