Page tree
Skip to end of metadata
Go to start of metadata

template<typename T >
template< typename T > T FB::variant::cast ( ) const

returns the value cast as the given type; throws bad_variant_type if that type is not the type of the value stored in variant

bad_variant_castThrown when bad variant cast.
value of type T

Definition at line 370 of file variant.h.

References get_type().

Referenced by FB::JSAPIAuto::FireJSEvent().

370  {
371  if (get_type() != typeid(T)) {
372  throw bad_variant_cast(get_type(), typeid(T));
373  }
374  return boost::any_cast<T>(object);
375  }
const std::type_info & get_type() const
Gets the type of the value stored in variant.
Definition: variant.h:307

Here is the call graph for this function:

  • No labels