/usr/include/wibble/cast.h is in libwibble-dev 0.1.28-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | // -*- C++ -*-
#include <wibble/exception.h>
#ifndef WIBBLE_CAST_H
#define WIBBLE_CAST_H
namespace wibble {
template <typename T, typename X> T &downcast(X *v) {
if (!v)
throw exception::BadCastExt< X, T >( "downcast on null pointer" );
T *x = dynamic_cast<T *>(v);
if (!x)
throw exception::BadCastExt< X, T >( "dynamic downcast failed" );
return *x;
}
template< typename T >
typename T::WrappedType &unwrap( const T &x ) {
return x.unwrap();
}
template< typename T >
T &unwrap( T &x ) { return x; }
template< typename _T, typename In > struct IsType {
typedef _T T;
};
}
#endif
|