[cleanup] replace typedef by using

This commit is contained in:
Bernd Flemisch
2020-06-10 13:49:42 +02:00
parent bdb7bac3e8
commit d72de0f308
224 changed files with 2232 additions and 2240 deletions

View File

@@ -115,23 +115,23 @@ class aligned_allocator {
static_assert(detail::is_alignment_constant<Alignment>::value, "Alignment must be powers of two!");
public:
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef void* void_pointer;
typedef const void* const_void_pointer;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T& reference;
typedef const T& const_reference;
using value_type = T;
using pointer = T*;
using const_pointer = const T*;
using void_pointer = void*;
using const_void_pointer = const void*;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using reference = T&;
using const_reference = const T&;
private:
typedef detail::max_align<Alignment, detail::alignment_of<value_type>::value> MaxAlign;
using MaxAlign = detail::max_align<Alignment, detail::alignment_of<value_type>::value>;
public:
template<class U>
struct rebind {
typedef aligned_allocator<U, Alignment> other;
using other = aligned_allocator<U, Alignment>;
};
aligned_allocator()
@@ -196,13 +196,13 @@ class aligned_allocator<void, Alignment> {
"The specified alignment is not a power of two!");
public:
typedef void value_type;
typedef void* pointer;
typedef const void* const_pointer;
using value_type = void;
using pointer = void*;
using const_pointer = const void*;
template<class U>
struct rebind {
typedef aligned_allocator<U, Alignment> other;
using other = aligned_allocator<U, Alignment>;
};
};

View File

@@ -193,7 +193,7 @@ struct Scalar<TypeTag, TTag::NumericModel> { using type = double; };
template<class TypeTag>
struct ParameterTree<TypeTag, TTag::NumericModel>
{
typedef Dune::ParameterTree type;
using type = Dune::ParameterTree;
static Dune::ParameterTree& tree()
{
@@ -214,8 +214,8 @@ struct GridFile<TypeTag, TTag::NumericModel> { static constexpr auto value = "";
template<class TypeTag>
struct GridPart<TypeTag, TTag::NumericModel>
{
typedef GetPropType<TypeTag, Properties::Grid> Grid;
typedef Dune::Fem::AdaptiveLeafGridPart<Grid> type;
using Grid = GetPropType<TypeTag, Properties::Grid>;
using type = Dune::Fem::AdaptiveLeafGridPart<Grid>;
};
template<class TypeTag>

View File

@@ -239,7 +239,7 @@ struct ParameterMetaData { using type = UndefinedProperty; };
template<class TypeTag>
struct ParameterMetaData<TypeTag, TTag::ParameterSystem>
{
typedef Dune::ParameterTree type;
using type = Dune::ParameterTree;
static Dune::ParameterTree& tree()
{ return *storage_().tree; }
@@ -481,7 +481,7 @@ inline void getFlattenedKeyList_(std::list<std::string>& dest,
template <class TypeTag>
void printParamList_(std::ostream& os, const std::list<std::string>& keyList, bool printDefaults = false)
{
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
const Dune::ParameterTree& tree = ParamsMeta::tree();
@@ -516,7 +516,7 @@ void printUsage(const std::string& helpPreamble,
const std::string& errorMsg = "",
std::ostream& os = std::cerr)
{
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
if (errorMsg != "") {
os << errorMsg << "\n"
@@ -852,7 +852,7 @@ void parseParameterFile(const std::string& fileName, bool overwrite = true)
template <class TypeTag>
void printValues(std::ostream& os = std::cout)
{
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
const Dune::ParameterTree& tree = ParamsMeta::tree();
@@ -920,7 +920,7 @@ void printValues(std::ostream& os = std::cout)
template <class TypeTag>
bool printUnused(std::ostream& os = std::cout)
{
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
const Dune::ParameterTree& tree = ParamsMeta::tree();
std::list<std::string> runTimeAllKeyList;
@@ -952,7 +952,7 @@ bool printUnused(std::ostream& os = std::cout)
template <class TypeTag>
class Param
{
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
public:
template <class ParamType, class PropTag>
@@ -1027,7 +1027,7 @@ private:
const std::string& propertyName,
const char *paramName)
{
typedef std::unordered_map<std::string, Blubb> StaticData;
using StaticData = std::unordered_map<std::string, Blubb>;
static StaticData staticData;
typename StaticData::iterator it = staticData.find(paramName);
@@ -1111,7 +1111,7 @@ void getLists(Container& usedParams, Container& unusedParams)
usedParams.clear();
unusedParams.clear();
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
if (ParamsMeta::registrationOpen())
throw std::runtime_error("Parameter lists can only retieved after _all_ of them have "
"been registered.");
@@ -1150,7 +1150,7 @@ bool isSet(const char *propTagName, const char *paramName, bool errorIfNotRegist
template <class TypeTag, class ParamType>
void registerParam(const char *paramName, const char *propertyName, const ParamType& defaultValue, const char *usageString)
{
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
if (!ParamsMeta::registrationOpen())
throw std::logic_error("Parameter registration was already closed before "
"the parameter '"+std::string(paramName)+"' was registered.");
@@ -1184,7 +1184,7 @@ void registerParam(const char *paramName, const char *propertyName, const ParamT
template <class TypeTag, class ParamType>
void hideParam(const char *paramName, const ParamType& defaultValue)
{
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
if (!ParamsMeta::registrationOpen())
throw std::logic_error("Parameter '"+std::string(paramName)+"' declared as hidden"
" when parameter registration was already closed.");
@@ -1201,7 +1201,7 @@ void hideParam(const char *paramName, const ParamType& defaultValue)
template <class TypeTag>
void endParamRegistration()
{
typedef GetProp<TypeTag, Properties::ParameterMetaData> ParamsMeta;
using ParamsMeta = GetProp<TypeTag, Properties::ParameterMetaData>;
if (!ParamsMeta::registrationOpen())
throw std::logic_error("Parameter registration was already closed. It is only possible "
"to close it once.");

View File

@@ -47,9 +47,9 @@ namespace Opm {
template <class GridView, class Stencil, class Data, class DofMapper>
class PffGridVector
{
typedef typename GridView::template Codim<0>::Entity Element;
using Element = typename GridView::template Codim<0>::Entity;
typedef Dune::MultipleCodimMultipleGeomTypeMapper<GridView> ElementMapper;
using ElementMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>;
public:
PffGridVector(const GridView& gridView, const DofMapper& dofMapper)

View File

@@ -369,7 +369,7 @@ SET_PROP_(EffTypeTagName, \
PropTagName, \
/*value=*/TTAG(ValueTypeTagName)) \
{ \
typedef TTAG(ValueTypeTagName) type; \
using type = TTAG(ValueTypeTagName); \
}
} // namespace Properties

View File

@@ -41,8 +41,8 @@ class QuadrialteralQuadratureGeometry
public:
enum { numCorners = (1 << dim) };
typedef Dune::FieldVector<Scalar, dim> LocalPosition;
typedef Dune::FieldVector<Scalar, dim> GlobalPosition;
using LocalPosition = Dune::FieldVector<Scalar, dim>;
using GlobalPosition = Dune::FieldVector<Scalar, dim>;
Dune::GeometryType type() const
{ return Dune::GeometryType(/*topologyId=*/(1 << dim) - 1, dim); }

View File

@@ -89,11 +89,11 @@ namespace Opm {
template <class TypeTag>
class Simulator
{
typedef GetPropType<TypeTag, Properties::Scalar> Scalar;
typedef GetPropType<TypeTag, Properties::Vanguard> Vanguard;
typedef GetPropType<TypeTag, Properties::GridView> GridView;
typedef GetPropType<TypeTag, Properties::Model> Model;
typedef GetPropType<TypeTag, Properties::Problem> Problem;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Vanguard = GetPropType<TypeTag, Properties::Vanguard>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
using Model = GetPropType<TypeTag, Properties::Model>;
using Problem = GetPropType<TypeTag, Properties::Problem>;
public:
// do not allow to copy simulators around
@@ -887,7 +887,7 @@ public:
*/
void serialize()
{
typedef Opm::Restart Restarter;
using Restarter = Opm::Restart;
Restarter res;
res.serializeBegin(*this);
if (gridView().comm().rank() == 0)

View File

@@ -75,8 +75,8 @@ namespace Opm {
template <class TypeTag>
static inline void registerAllParameters_(bool finalizeRegistration = true)
{
typedef GetPropType<TypeTag, Properties::Simulator> Simulator;
typedef GetPropType<TypeTag, Properties::ThreadManager> ThreadManager;
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
using ThreadManager = GetPropType<TypeTag, Properties::ThreadManager>;
EWOMS_REGISTER_PARAM(TypeTag, std::string, ParameterFile,
"An .ini file which contains a set of run-time "
@@ -111,7 +111,7 @@ static inline int setupParameters_(int argc,
bool allowUnused=false,
bool handleHelp = true)
{
typedef GetPropType<TypeTag, Properties::Problem> Problem;
using Problem = GetPropType<TypeTag, Properties::Problem>;
// first, get the MPI rank of the current process
int myRank = 0;
@@ -172,8 +172,8 @@ static inline int setupParameters_(int argc,
}
// make sure that no unknown parameters are encountered
typedef std::pair<std::string, std::string> KeyValuePair;
typedef std::list<KeyValuePair> ParamList;
using KeyValuePair = std::pair<std::string, std::string>;
using ParamList = std::list<KeyValuePair>;
ParamList usedParams;
ParamList unusedParams;
@@ -277,10 +277,10 @@ static inline void resetTerminal_(int signum)
template <class TypeTag>
static inline int start(int argc, char **argv, bool registerParams=true)
{
typedef GetPropType<TypeTag, Properties::Scalar> Scalar;
typedef GetPropType<TypeTag, Properties::Simulator> Simulator;
typedef GetPropType<TypeTag, Properties::Problem> Problem;
typedef GetPropType<TypeTag, Properties::ThreadManager> ThreadManager;
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
using Problem = GetPropType<TypeTag, Properties::Problem>;
using ThreadManager = GetPropType<TypeTag, Properties::ThreadManager>;
// set the signal handlers to reset the TTY to a well defined state on unexpected
// program aborts