Kaydet (Commit) bb9003c7 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Make cppu::UnoType<decltype(x)>::get() work when x is of reference type

...using C++11-only std::remove_reference, but decltype is also only C++11, so
3rd party C++03 code should have no need for it anyway.  (Commits acutally
making use of it to follow shortly.)

Change-Id: I8dd7a64ca73d2082a3e7b74d3599848e65e81da5
üst 2302e9eb
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
#define INCLUDED_CPPU_UNOTYPE_HXX #define INCLUDED_CPPU_UNOTYPE_HXX
#include <sal/config.h> #include <sal/config.h>
#if __cplusplus >= 201103L
#include <type_traits>
#endif
#include <sal/types.h> #include <sal/types.h>
#include <typelib/typeclass.h> #include <typelib/typeclass.h>
#include <typelib/typedescription.h> #include <typelib/typedescription.h>
...@@ -264,7 +269,13 @@ template< typename T > class UnoType { ...@@ -264,7 +269,13 @@ template< typename T > class UnoType {
public: public:
static inline ::com::sun::star::uno::Type const & get() { static inline ::com::sun::star::uno::Type const & get() {
using namespace ::cppu::detail; using namespace ::cppu::detail;
return cppu_detail_getUnoType(static_cast< T * >(0)); #if __cplusplus >= 201103L
typedef typename std::remove_reference<T>::type T1;
// for certain uses of UnoType<decltype(x)>
#else
typedef T T1;
#endif
return cppu_detail_getUnoType(static_cast< T1 * >(0));
} }
private: private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment