mirror of https://github.com/CGAL/cgal
do not use exception in Object::assign. g++3.4 produces a segfault with -O2
This commit is contained in:
parent
dec7522a6e
commit
b30d3daa2b
|
|
@ -88,12 +88,21 @@ class Object
|
||||||
bool assign(T &t) const
|
bool assign(T &t) const
|
||||||
{
|
{
|
||||||
if(obj) {
|
if(obj) {
|
||||||
|
#ifdef CGAL_USE_ANY_BAD_CAST
|
||||||
try {
|
try {
|
||||||
t = boost::any_cast<T>(*obj);
|
t = boost::any_cast<T>(*obj);
|
||||||
return true;
|
return true;
|
||||||
} catch(...) {
|
} catch(...) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
const T* res = boost::any_cast<T>(&(*obj));
|
||||||
|
if (res){
|
||||||
|
t=*res;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue