Browse Source

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

tags/2021-05-28
jules 8 years ago
parent
commit
e7923af185
5 changed files with 18 additions and 16 deletions
  1. +1
    -1
      modules/juce_core/containers/juce_Array.h
  2. +1
    -1
      modules/juce_core/containers/juce_ElementComparator.h
  3. +2
    -2
      modules/juce_core/containers/juce_HashMap.h
  4. +13
    -11
      modules/juce_core/maths/juce_MathsFunctions.h
  5. +1
    -1
      modules/juce_gui_basics/mouse/juce_SelectedItemSet.h

+ 1
- 1
modules/juce_core/containers/juce_Array.h 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:
//==============================================================================


+ 1
- 1
modules/juce_core/containers/juce_ElementComparator.h 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)


+ 2
- 2
modules/juce_core/containers/juce_HashMap.h 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:
//==============================================================================


+ 13
- 11
modules/juce_core/maths/juce_MathsFunctions.h 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; };
}


+ 1
- 1
modules/juce_gui_basics/mouse/juce_SelectedItemSet.h 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. */


Loading…
Cancel
Save