Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Namespaces | Functions
G4AnyType.hh File Reference
#include <algorithm>
#include <typeinfo>
#include <iostream>
#include <sstream>
#include "G4UIcommand.hh"

Go to the source code of this file.

Data Structures

class  G4AnyType
 
class  G4BadAnyCast
 

Namespaces

 CLHEP
 

Functions

template<typename ValueType >
ValueType * any_cast (G4AnyType *operand)
 
template<typename ValueType >
const ValueType * any_cast (const G4AnyType *operand)
 
template<typename ValueType >
ValueType any_cast (const G4AnyType &operand)
 

Function Documentation

template<typename ValueType >
ValueType* any_cast ( G4AnyType operand)

value

Definition at line 213 of file G4AnyType.hh.

References G4AnyType::TypeInfo().

Referenced by any_cast().

213  {
214  return operand && operand->TypeInfo() == typeid(ValueType)
215  ? &static_cast<G4AnyType::Ref<ValueType>*>(operand->fContent)->fRef : 0;
216 }
const std::type_info & TypeInfo() const
Definition: G4AnyType.hh:106
template<typename ValueType >
const ValueType* any_cast ( const G4AnyType operand)

value

Definition at line 218 of file G4AnyType.hh.

References any_cast().

218  {
219  return any_cast<ValueType>(const_cast<G4AnyType*>(operand));
220 }
ValueType * any_cast(G4AnyType *operand)
Definition: G4AnyType.hh:213
template<typename ValueType >
ValueType any_cast ( const G4AnyType operand)

value

Definition at line 222 of file G4AnyType.hh.

References any_cast().

222  {
223  const ValueType* result = any_cast<ValueType>(&operand);
224  if (!result) {
225  throw G4BadAnyCast();
226  }
227  return *result;
228 }
ValueType * any_cast(G4AnyType *operand)
Definition: G4AnyType.hh:213