template T assertAsValue()

in cpp/src/assert.cpp [36:56]


template<class T> T assertAsValue(const boost::any &value) {
  if (typeid(shared_ptr<T>) == value.type()) {
    shared_ptr<T> ptr = cast_any<T>(value);
    if (ptr) {
      return *ptr;
    }
  } else if (typeid(shared_ptr<boost::any>) == value.type()) {
    shared_ptr<boost::any> any_ptr = cast_any<boost::any>(value);
    if (any_ptr && !any_ptr->empty()) {
      if (typeid(shared_ptr<T>) == any_ptr->type()) {
        shared_ptr<T> ptr = cast_any<T>(*any_ptr);
        if (ptr) {
          return *ptr;
        }
      } else if (typeid(T) == any_ptr->type()) {
        return boost::any_cast<T>(*any_ptr);
      }
    }
  }
  throw exception();
}