Request for Ogre::any_cast without throw

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Lax
Gnoll
Posts: 667
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 64

Request for Ogre::any_cast without throw

Post by Lax »

Hi,

I have an request, as I get polluted with messages about invalid casting.
I try to cast things to my GameEngine's GameObject and I know that it is not always possible. So I use try...catch.
But the log is full of execeptions:

Code: Select all

22:18:50: OGRE EXCEPTION(2:InvalidParametersException): Bad cast from type 'void' to 'class NOWA::GameObject * __ptr64 in Ogre::any_cast at C:\Users\lukas\Documents\GameEngineDevelopment\external\Ogre2.2SDK\OgreMain\include\OgreAny.h (line 340)

Would it be possible to add a second parameter for cast like:

Code: Select all

any_cast( const Any &operand, bool throws = true )

So that I could use it without throwing?

MyGUI is using the same approach.

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62