1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Got rid of the old PARAMETER_TYPE macro - this isn't needed as the same thing can be done directly with the TypeHelpers::ParameterType helper class

This commit is contained in:
jules 2017-05-10 09:37:37 +01:00
parent cca665b896
commit e7923af185
5 changed files with 18 additions and 16 deletions

View file

@ -53,7 +53,7 @@ template <typename ElementType,
class Array
{
private:
typedef PARAMETER_TYPE (ElementType) ParameterType;
typedef typename TypeHelpers::ParameterType<ElementType>::type ParameterType;
public:
//==============================================================================

View file

@ -175,7 +175,7 @@ template <class ElementType>
class DefaultElementComparator
{
private:
typedef PARAMETER_TYPE (ElementType) ParameterType;
typedef typename TypeHelpers::ParameterType<ElementType>::type ParameterType;
public:
static int compareElements (ParameterType first, ParameterType second)

View file

@ -93,8 +93,8 @@ template <typename KeyType,
class HashMap
{
private:
typedef PARAMETER_TYPE (KeyType) KeyTypeParameter;
typedef PARAMETER_TYPE (ValueType) ValueTypeParameter;
typedef typename TypeHelpers::ParameterType<KeyType>::type KeyTypeParameter;
typedef typename TypeHelpers::ParameterType<ValueType>::type ValueTypeParameter;
public:
//==============================================================================

View file

@ -585,10 +585,7 @@ namespace TypeHelpers
Of course, this is only likely to be useful in certain esoteric template situations.
Because "typename TypeHelpers::ParameterType<SomeClass>::type" is a bit of a mouthful, there's
a PARAMETER_TYPE(SomeClass) macro that you can use to get the same effect.
E.g. "myFunction (PARAMETER_TYPE (int), PARAMETER_TYPE (MyObject))"
E.g. "myFunction (typename TypeHelpers::ParameterType<int>::type, typename TypeHelpers::ParameterType<MyObject>::type)"
would evaluate to "myfunction (int, const MyObject&)", keeping any primitive types as
pass-by-value, but passing objects as a const reference, to avoid copying.
*/
@ -612,16 +609,21 @@ namespace TypeHelpers
template <> struct ParameterType <double> { typedef double type; };
#endif
/** A helpful macro to simplify the use of the ParameterType template.
@see ParameterType
*/
#define PARAMETER_TYPE(a) typename TypeHelpers::ParameterType<a>::type
/** These templates are designed to take a type, and if it's a double, they return a double
type; for anything else, they return a float type.
*/
template <typename Type> struct SmallestFloatType { typedef float type; };
template <> struct SmallestFloatType <double> { typedef double type; };
template <typename Type> struct SmallestFloatType { typedef float type; };
template <> struct SmallestFloatType <double> { typedef double type; };
/** These templates are designed to take an integer type, and return an unsigned int
version with the same size.
*/
template <int bytes> struct UnsignedTypeWithSize {};
template <> struct UnsignedTypeWithSize<1> { typedef uint8 type; };
template <> struct UnsignedTypeWithSize<2> { typedef uint16 type; };
template <> struct UnsignedTypeWithSize<4> { typedef uint32 type; };
template <> struct UnsignedTypeWithSize<8> { typedef uint64 type; };
}

View file

@ -47,7 +47,7 @@ public:
//==============================================================================
typedef SelectableItemType ItemType;
typedef Array<SelectableItemType> ItemArray;
typedef PARAMETER_TYPE (SelectableItemType) ParameterType;
typedef typename TypeHelpers::ParameterType<SelectableItemType>::type ParameterType;
//==============================================================================
/** Creates an empty set. */