do not use exception in Object::assign. g++3.4 produces a segfault with -O2

This commit is contained in:
Sébastien Loriot 2013-06-12 17:39:31 +02:00
parent dec7522a6e
commit b30d3daa2b
1 changed files with 9 additions and 0 deletions

View File

@ -88,12 +88,21 @@ class Object
bool assign(T &t) const
{
if(obj) {
#ifdef CGAL_USE_ANY_BAD_CAST
try {
t = boost::any_cast<T>(*obj);
return true;
} catch(...) {
return false;
}
#else
const T* res = boost::any_cast<T>(&(*obj));
if (res){
t=*res;
return true;
}
return false;
#endif
} else {
return false;
}