Commit 8d55ef3e authored by Ben Huber's avatar Ben Huber

'using' instead of 'typedef' for better legibility; this BREAKS compatibility with gcc <= 4.8.1

parent a4c997b1
......@@ -39,7 +39,7 @@ namespace xerus {
* @details In future versions this should be allowed to be float, double, or complex.
* In the current version however this is fixed to double.
*/
typedef double value_t;
using value_t = double;
/**
* @brief The default epsilon value in xerus.
......
......@@ -32,7 +32,7 @@ namespace xerus {
class TensorNetwork;
namespace internal {
typedef void (*ContractionHeuristic)(double &, std::vector<std::pair<size_t,size_t>> &, TensorNetwork);
using ContractionHeuristic = void (*)(double &, std::vector<std::pair<size_t,size_t>> &, TensorNetwork);
template<double (*scoreFct)(double, double, double, double, double)>
void greedy_heuristic(double &_bestCost, std::vector<std::pair<size_t,size_t>> &_contractions, TensorNetwork _network);
......
......@@ -27,10 +27,11 @@
namespace xerus {
class Tensor;
class TensorNetwork;
template<bool isOperator> class TTNetwork;
typedef TTNetwork<false> TTTensor;
typedef TTNetwork<true> TTOperator;
class TensorNetwork;
template<bool isOperator> class TTNetwork;
using TTTensor = TTNetwork<false>;
using TTOperator = TTNetwork<true>;
class SinglePointMeasurementSet;
class RankOneMeasurementSet;
......
......@@ -512,8 +512,8 @@ namespace xerus {
};
typedef HTNetwork<false> HTTensor;
typedef HTNetwork<true> HTOperator;
using HTTensor = HTNetwork<false>;
using HTOperator = HTNetwork<true>;
/**
......
......@@ -45,23 +45,22 @@ namespace xerus {
extern const int VERSION_REVISION;
extern const int VERSION_COMMIT;
// Shorter names for unsigned types
typedef uint8_t byte; ///< unsigned int type of exactly 8 bit
typedef unsigned short ushort;
typedef unsigned int uint;
typedef unsigned long ulong;
// Shorter names for unsigned types
using byte = uint8_t;
using ushort = unsigned short;
using uint = unsigned int;
using ulong = unsigned long;
// Shorter names for fixed width types
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;
// Shorter names for fixed width types
using int8 = int8_t;
using int16 = int16_t;
using int32 = int32_t;
using int64 = int64_t;
using uint8 = uint8_t;
using uint16 = uint16_t;
using uint32 = uint32_t;
using uint64 = uint64_t;
}
/**
......@@ -80,7 +79,7 @@ namespace xerus {
*/
#if __cplusplus > 201400L
#define XERUS_deprecated(msg) [[deprecated(msg)]]
#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__) > 409
#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 409
#define XERUS_deprecated(msg) [[gnu::deprecated(msg)]]
#else
#define XERUS_deprecated(msg)
......
......@@ -32,12 +32,9 @@
#include "basic.h"
#include "tensorNetwork.h"
#include "forwardDeclarations.h"
namespace xerus {
template<bool isOperator> class TTNetwork;
typedef TTNetwork<false> TTTensor;
typedef TTNetwork<true> TTOperator;
/// @brief Storage class for the performance data collected during an algorithm (typically iteration count, time and residual)
class PerformanceData {
public:
......
......@@ -89,10 +89,10 @@ namespace xerus {
enum class Representation : bool { Dense, Sparse };
///@brief: Represention of the dimensions of a Tensor.
typedef std::vector<size_t> DimensionTuple; // NOTE must not be declared as "using.." (internal segfault in gcc4.8.1)
using DimensionTuple = std::vector<size_t>;
///@brief: Represention of a MultiIndex, i.e. the tuple of positions for each dimension determining a single position in a Tensor.
typedef std::vector<size_t> MultiIndex; // NOTE must not be declared as "using.." (internal segfault in gcc4.8.1)
using MultiIndex = std::vector<size_t>;
/*- - - - - - - - - - - - - - - - - - - - - - - - - - Member variables - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
/// @brief Vector containing the individual dimensions of the tensor.
......
......@@ -44,7 +44,7 @@
struct xerus_test_a{ static void rt() {\
xerus::misc::internal::RequiredTest::register_test(xerus_test_fname, __FILE__, __LINE__);\
} };\
typedef void (*xerus_test_t)();\
using xerus_test_t = void (*)();\
static xerus_test_t xerus_test_rtp __attribute__((section(".init_array"))) = &xerus_test_a::rt; \
(void)xerus_test_rtp; \
xerus::misc::internal::RequiredTest::increase_counter(xerus_test_fname, __FILE__, __LINE__); \
......
......@@ -516,8 +516,8 @@ namespace xerus {
};
typedef TTNetwork<false> TTTensor;
typedef TTNetwork<true> TTOperator;
using TTTensor = TTNetwork<false>;
using TTOperator = TTNetwork<true>;
/**
......
......@@ -54,7 +54,7 @@ namespace xerus { namespace misc { namespace internal {
struct bfdResolver {
/// @brief relevant information belonging to a single bfd
struct storedBfd {
typedef bfd_boolean(deleter_t)(bfd*);
using deleter_t = bfd_boolean (*)(bfd*);
std::unique_ptr<bfd, deleter_t*> abfd;
std::unique_ptr<asymbol*[]> symbols;
intptr_t offset;
......
......@@ -164,7 +164,7 @@ namespace xerus { namespace misc {
#undef main
int main(int argc, char* argv[]) {
typedef void (*required_test_t)(void);
using required_test_t = void (*)();
// signal(SIGINT, xerus::misc::internal::catch_signals); // users ctrl+c should actually terminate the program
// signal(SIGTERM, xerus::misc::internal::catch_signals);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment