Revert 6f68e52 and fix the gcc2 build via template.
* Instead of forcing the hash-table to use a copy of the key, introduce and use TypeOperation template to avoid taking a reference of a reference type (which gcc2 doesn't allow).
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright 2014, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Based on TypeOp in "C++-Templates, The Complete Guide", which is
|
||||
* Copyright 2003 by Pearson Education, Inc.
|
||||
*/
|
||||
#ifndef _TYPE_OPERATION_H
|
||||
#define _TYPE_OPERATION_H
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
// Generic type conversion operations.
|
||||
template<typename T>
|
||||
class TypeOperation {
|
||||
public:
|
||||
typedef T ArgT;
|
||||
typedef T BareT;
|
||||
typedef T const ConstT;
|
||||
|
||||
typedef T& RefT;
|
||||
typedef T& BareRefT;
|
||||
typedef T const& ConstRefT;
|
||||
};
|
||||
|
||||
|
||||
// Specialization for constant types.
|
||||
template<typename T>
|
||||
class TypeOperation<T const> {
|
||||
public:
|
||||
typedef T const ArgT;
|
||||
typedef T BareT;
|
||||
typedef T const ConstT;
|
||||
|
||||
typedef T const& RefT;
|
||||
typedef T& BareRefT;
|
||||
typedef T const& ConstRefT;
|
||||
};
|
||||
|
||||
|
||||
// Specialization for reference types.
|
||||
template<typename T>
|
||||
class TypeOperation<T&> {
|
||||
public:
|
||||
typedef T& ArgT;
|
||||
typedef typename TypeOperation<T>::BareT BareT;
|
||||
typedef T const ConstT;
|
||||
|
||||
typedef T& RefT;
|
||||
typedef typename TypeOperation<T>::BareRefT BareRefT;
|
||||
typedef T const& ConstRefT;
|
||||
};
|
||||
|
||||
|
||||
// Specialization for void.
|
||||
template<>
|
||||
class TypeOperation<void> {
|
||||
public:
|
||||
typedef void ArgT;
|
||||
typedef void BareT;
|
||||
typedef void const ConstT;
|
||||
|
||||
typedef void RefT;
|
||||
typedef void BareRefT;
|
||||
typedef void ConstRefT;
|
||||
};
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
using BPrivate::TypeOperation;
|
||||
|
||||
|
||||
#endif // _TYPE_OPERATION_H
|
||||
Reference in New Issue
Block a user