refs #624 Replace typedef with using.

This commit is contained in:
Mathew Sutcliffe
2016-03-20 21:52:49 +00:00
parent a8fc899219
commit 6f1cf8e3d7
22 changed files with 47 additions and 47 deletions

View File

@@ -34,7 +34,7 @@ namespace BlackMisc
{
public:
//! Type of values stored in the set.
typedef T value_type;
using value_type = T;
//! Insert a new value into the set.
typename QMap<T, T>::iterator insert(const T &value) { return QMap<T, T>::insert(value, value); }
@@ -447,7 +447,7 @@ namespace BlackMisc
template <class I> static I insertHelper(std::pair<I, bool> p) { return p.first; }
};
typedef QScopedPointer<PimplBase> PimplPtr;
using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl;
CCollection(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()

View File

@@ -93,7 +93,7 @@ namespace BlackMisc
public:
//! The implementation container
typedef Impl<Key,Value> impl_type;
using impl_type = Impl<Key,Value>;
//! STL compatibility
//! @{

View File

@@ -27,17 +27,17 @@ namespace BlackMisc
struct index_sequence
{
static const size_t size = sizeof...(Is);
typedef std::tuple<std::integral_constant<size_t, Is>...> tuple_type;
using tuple_type = std::tuple<std::integral_constant<size_t, Is>...>;
};
template <size_t I, size_t C, size_t... Is>
struct GenSequence
{
typedef typename GenSequence<I + 1, C, Is..., I>::type type;
using type = typename GenSequence<I + 1, C, Is..., I>::type;
};
template <size_t C, size_t... Is>
struct GenSequence<C, C, Is...>
{
typedef index_sequence<Is...> type;
using type = index_sequence<Is...>;
};
template <size_t C>
using make_index_sequence = typename GenSequence<0, C>::type;

View File

@@ -54,7 +54,7 @@ namespace BlackMisc
// http://en.wikibooks.org/wiki/More_C++_Idioms/Member_Detector
struct Empty {};
struct Fallback { int propertyByIndex; };
template <int Fallback:: *> struct int_t { typedef int type; };
template <int Fallback:: *> struct int_t { using type = int; };
template <typename U> struct Derived : public Fallback, public std::conditional_t<std::is_void<U>::value, Empty, U> {};
template <typename U> static void test(typename int_t<&Derived<U>::propertyByIndex>::type);
@@ -62,7 +62,7 @@ namespace BlackMisc
public:
//! Type of T::base_type, or void if not declared.
typedef decltype(test<typename BaseOf<T>::type>(0)) type;
using type = decltype(test<typename BaseOf<T>::type>(0));
};
/*!

View File

@@ -426,7 +426,7 @@ namespace BlackMisc
I m_impl;
};
typedef QScopedPointer<PimplBase> PimplPtr;
using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl;
explicit ConstForwardIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
@@ -633,7 +633,7 @@ namespace BlackMisc
I m_impl;
};
typedef QScopedPointer<PimplBase> PimplPtr;
using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl;
explicit ConstBidirectionalIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()
@@ -854,7 +854,7 @@ namespace BlackMisc
I m_impl;
};
typedef QScopedPointer<PimplBase> PimplPtr;
using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl;
explicit BidirectionalIterator(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()

View File

@@ -228,7 +228,7 @@ namespace BlackMisc
MU m_unit; //!< unit part
//! Which subclass of CMeasurementUnit is used?
typedef MU UnitClass;
using UnitClass = MU;
//! Implementation of compare
static int compareImpl(const PQ &, const PQ &);

View File

@@ -55,7 +55,7 @@ namespace BlackMisc
struct FeetToMeters { static double factor() { return 0.3048; } };
struct MilesToMeters { static double factor() { return 1609.344; } };
struct StatuteMilesToMeters { static double factor() { return 1609.3472; } };
typedef One MetersToMeters;
using MetersToMeters = One;
public:
//! Base type
@@ -170,7 +170,7 @@ namespace BlackMisc
{}
struct RadiansToDegrees { static double factor() { return 180.0 / M_PI; } };
typedef One DegreesToDegrees;
using DegreesToDegrees = One;
public:
//! Base type
@@ -268,7 +268,7 @@ namespace BlackMisc
CMeasurementUnit(name, symbol, nullptr)
{}
typedef One HertzToHertz;
using HertzToHertz = One;
public:
//! Base type
@@ -358,7 +358,7 @@ namespace BlackMisc
CMeasurementUnit(name, symbol, nullptr)
{}
typedef Milli<One> GramsToKilograms;
using GramsToKilograms = Milli<One>;
struct PoundsToKilograms { static double factor() { return 0.45359237; } };
public:
@@ -457,7 +457,7 @@ namespace BlackMisc
CMeasurementUnit(name, symbol, nullptr)
{}
typedef Centi<One> PascalsToHectopascals;
using PascalsToHectopascals = Centi<One>;
struct PsiToHectopascals { static double factor() { return 68.948; } };
struct InchesToHectopascals { static double factor() { return 33.86389; } };
struct MillimetersToHectopascals { static double factor() { return 860.142806; } };
@@ -773,7 +773,7 @@ namespace BlackMisc
CMeasurementUnit(name, symbol, nullptr)
{}
typedef One SecondsToSeconds;
using SecondsToSeconds = One;
struct DaysToSeconds { static double factor() { return 60.0 * 60.0 * 24.0; } };
struct HoursToSeconds { static double factor() { return 60.0 * 60.0; } };
struct MinutesToSeconds { static double factor() { return 60.0; } };

View File

@@ -704,7 +704,7 @@ namespace BlackMisc
C m_impl;
};
typedef QScopedPointer<PimplBase> PimplPtr;
using PimplPtr = QScopedPointer<PimplBase>;
PimplPtr m_pimpl;
explicit CSequence(PimplBase *pimpl) : m_pimpl(pimpl) {} // private ctor used by fromImpl()

View File

@@ -25,7 +25,7 @@
#endif
#include <Windows.h>
#else
typedef unsigned long DWORD; //!< Fake Windows DWORD
using DWORD = unsigned long; //!< Fake Windows DWORD
#endif
namespace BlackMisc

View File

@@ -36,10 +36,10 @@ namespace BlackMisc
static const int MaxPartsPerCallsign = 3; //!< How many parts per callsign
//! Situations per callsign
typedef QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftSituationList> CSituationsPerCallsign;
using CSituationsPerCallsign = QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftSituationList>;
//! Parts per callsign
typedef QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftPartsList> CPartsPerCallsign;
using CPartsPerCallsign = QHash<BlackMisc::Aviation::CCallsign, BlackMisc::Aviation::CAircraftPartsList>;
//! All remote aircraft
//! \threadsafe

View File

@@ -43,7 +43,7 @@ namespace BlackMisc
* \ingroup Tuples
*/
#define BLACK_ENABLE_TUPLE_CONVERSION(T) \
public: typedef std::true_type EnabledTupleConversion; \
public: using EnabledTupleConversion = std::true_type; \
private: friend class BlackMisc::TupleConverter<T>;
/*!

View File

@@ -53,7 +53,7 @@ namespace BlackMisc
template <class T>
struct HasEnabledTupleConversion
{
typedef decltype(hasEnabledTupleConversionHelper(static_cast<T *>(nullptr))) type;
using type = decltype(hasEnabledTupleConversionHelper(static_cast<T *>(nullptr)));
static const bool value = type::value;
};
@@ -80,23 +80,23 @@ namespace BlackMisc
struct GenSequenceOnPredicate<P, I, C, true, I2, Is...>
{
static const bool test = P::template test<I>::value;
typedef typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is..., I2>::type type;
using type = typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is..., I2>::type;
};
template <class P, size_t I, size_t C, size_t I2, size_t... Is>
struct GenSequenceOnPredicate<P, I, C, false, I2, Is...>
{
static const bool test = P::template test<I>::value;
typedef typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is...>::type type;
using type = typename GenSequenceOnPredicate<P, I + 1, C, test, I, Is...>::type;
};
template <class P, size_t C, size_t I2, size_t... Is>
struct GenSequenceOnPredicate<P, C, C, true, I2, Is...>
{
typedef index_sequence<Is..., I2> type;
using type = index_sequence<Is..., I2>;
};
template <class P, size_t C, size_t I2, size_t... Is>
struct GenSequenceOnPredicate<P, C, C, false, I2, Is...>
{
typedef index_sequence<Is...> type;
using type = index_sequence<Is...>;
};
template <class P>
using make_index_sequence_if = typename GenSequenceOnPredicate<P, 0, std::tuple_size<typename P::tuple_type>::value>::type;
@@ -105,14 +105,14 @@ namespace BlackMisc
template <qint64 F, class Tu>
struct FlagPresent
{
typedef Tu tuple_type;
using tuple_type = Tu;
template <size_t I>
struct test : std::integral_constant<bool, bool(std::tuple_element_t<I, Tu>::flags & F)> {};
};
template <qint64 F, class Tu>
struct FlagMissing
{
typedef Tu tuple_type;
using tuple_type = Tu;
template <size_t I>
struct test : std::integral_constant<bool, ! bool(std::tuple_element_t<I, Tu>::flags & F)> {};
};
@@ -171,7 +171,7 @@ namespace BlackMisc
template <class T, qint64 Flags = 0>
struct Attribute : public AttributeComparable<Attribute<T, Flags>, bool(Flags & DisabledForComparison), bool(Flags & CaseInsensitiveComparison)>
{
typedef T type;
using type = T;
static const qint64 flags = Flags;
Attribute(T &obj, QString jsonName = {}) : m_obj(obj), m_jsonName(jsonName) {}

View File

@@ -42,7 +42,7 @@ namespace BlackMisc
//! \private SFINAE for CValueObject constructor to avoid being selected as a viable copy constructor.
template <typename...> struct DecayFirst
{
typedef void type;
using type = void;
};
//! \private
template <typename T, typename... Ts> struct DecayFirst<T, Ts...>

View File

@@ -122,7 +122,7 @@ namespace BlackMisc
//! \cond PRIVATE
// http://en.wikibooks.org/wiki/More_C++_Idioms/Member_Detector
struct Fallback { int toJson, convertFromJson, setPropertyByIndex, propertyByIndex, propertyByIndexAsString, equalsPropertyByIndex, toIcon; };
template <int Fallback::*> struct int_t { typedef int type; };
template <int Fallback::*> struct int_t { using type = int; };
template <typename U> struct Derived : public U, public Fallback {};
# define DISABLE_IF_HAS(MEMBER) typename int_t<&Derived<U>::MEMBER>::type
//! \endcond