Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.12)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

project(mathic VERSION 1.4 LANGUAGES CXX)
Expand Down
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ dnl source and binary interface of the library and is not the same as the
dnl version of the project.
AC_SUBST([MATHIC_SO_VERSION], [0:4:0])

AX_CXX_COMPILE_STDCXX([17],,[mandatory])

dnl ----- The gtest dependency

AC_ARG_WITH([gtest],
Expand All @@ -83,7 +85,6 @@ AC_DEFUN([NO_GTEST_ERROR],

AS_IF([test "x$with_gtest" != "xno"],
[AC_LANG([C++])
AX_CXX_COMPILE_STDCXX([17],,[mandatory])
AC_CHECK_HEADER([gtest/gtest.h],
[AC_MSG_CHECKING([for library containing testing::InitGoogleTest])
SAVELIBS=$LIBS
Expand Down
4 changes: 2 additions & 2 deletions src/divsim/DivListModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class DivListModelConfiguration {
_minRebuild(minRebuild),
_expQueryCount(0) {}

static const bool UseLinkedList = ULL;
static const bool UseDivMask = UDM;
static constexpr bool UseLinkedList = ULL;
static constexpr bool UseDivMask = UDM;

bool getDoAutomaticRebuilds() const {return _useAutomaticRebuild;}
double getRebuildRatio() const {return _rebuildRatio;}
Expand Down
10 changes: 5 additions & 5 deletions src/divsim/KDTreeModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class KDTreeModelConfiguration {
double getRebuildRatio() const {return _rebuildRatio;}
size_t getRebuildMin() const {return _minRebuild;}

static const bool UseDivMask = UDM;
static const bool UseTreeDivMask = UTDM;
static const bool PackedTree = PT;
static const size_t LeafSize = LS;
static const bool AllowRemovals = AR;
static constexpr bool UseDivMask = UDM;
static constexpr bool UseTreeDivMask = UTDM;
static constexpr bool PackedTree = PT;
static constexpr size_t LeafSize = LS;
static constexpr bool AllowRemovals = AR;

unsigned long long getExpQueryCount() const {return _expQueryCount;}

Expand Down
2 changes: 1 addition & 1 deletion src/mathic/BinaryKDTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ namespace mathic {
typedef KDTreeInterior Interior;
typedef KDTreeLeaf Leaf;
typedef C Configuration;
static const bool UseDivMask = C::UseDivMask;
static constexpr bool UseDivMask = C::UseDivMask;

class KDTreeNode {
public:
Expand Down
4 changes: 2 additions & 2 deletions src/mathic/ComTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ namespace mathic {

//private:
friend class ComTree<Entry, FastIndex>;
static const bool fi = FastIndex;
static const size_t S = sizeof(Entry);
static constexpr bool fi = FastIndex;
static constexpr size_t S = sizeof(Entry);
explicit Node(size_t i): _index(i) {}
size_t getNormalIndex() const {return fi ? _index / S : _index;}
size_t _index;
Expand Down
5 changes: 3 additions & 2 deletions src/mathic/DivFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
Returns the number of variables. Variables are indexed from 0 to
getVarCount() - 1. Must be a positive number.

* static const bool UseDivMask
* static constexpr bool UseDivMask
Set to true to use div masks to speed up queries. This must be a
static const data member.
compile-time constant data member (static constexpr bool, or static
const bool with a constant initializer).

* size_t getUseAutomaticRebuild() const
* double getRebuildRatio() const
Expand Down
4 changes: 2 additions & 2 deletions src/mathic/DivList.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ namespace mathic {
typedef typename C::Monomial Monomial;
typedef typename C::Exponent Exponent;

static const bool UseLinkedList = C::UseLinkedList;
static const bool UseDivMask = C::UseDivMask;
static constexpr bool UseLinkedList = C::UseLinkedList;
static constexpr bool UseDivMask = C::UseDivMask;

private:
typedef typename DivMask::Extender<Entry, C::UseDivMask> ExtEntry;
Expand Down
2 changes: 1 addition & 1 deletion src/mathic/KDTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ namespace mathic {
_divisorCache = 0;
}

static const bool UseDivMask = C::UseDivMask;
static constexpr bool UseDivMask = C::UseDivMask;
typedef typename C::Monomial Monomial;
typedef typename C::Entry Entry;
typedef typename C::Exponent Exponent;
Expand Down
2 changes: 1 addition & 1 deletion src/mathic/PackedKDTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace mathic {

private:
typedef C Configuration;
static const bool UseDivMask = C::UseDivMask;
static constexpr bool UseDivMask = C::UseDivMask;

class Node {
public:
Expand Down
7 changes: 3 additions & 4 deletions src/mathic/PairQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ namespace mathic {
// configuration.
template<class Configuration>
struct SupportRetirement {
// the value field must be static bool const.
static bool const value = true;
static constexpr bool value = true;
};
}

Expand Down Expand Up @@ -198,7 +197,7 @@ namespace mathic {
typedef C Configuration;
typedef typename C::PairData PairData;
typedef PairQueueNamespace::Index Index;
static bool const SupportRetirement =
static constexpr bool SupportRetirement =
PairQueueNamespace::SupportRetirement<Configuration>::value;

// PairQueue stores a copy of the passed in configuration.
Expand Down Expand Up @@ -365,7 +364,7 @@ namespace mathic {
return mConf.cmpLessThan(cr);
}

static const bool fastIndex = false;
static constexpr bool fastIndex = false;

private:
Configuration& mConf;
Expand Down
4 changes: 4 additions & 0 deletions src/mathic/stdinc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef MATHIC_STDINC_GUARD
#define MATHIC_STDINC_GUARD

#if __cplusplus < 201703L
#error "mathic requires C++17 or later"
#endif

#ifdef _MSC_VER // For Microsoft Compiler in Visual Studio C++.
// Sometimes you know that a function will be called very rarely so you want to
// tell the compiler not to inline it even if it could be inlined at only a
Expand Down
12 changes: 6 additions & 6 deletions src/pqsim/GeobucketModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class GeobucketModelBase {
size_t geoBase;
size_t minBucketSize;

static const bool trackFront = TrackFront;
static const bool minBucketBinarySearch = MinBucketBinarySearch;
static const bool premerge = Premerge;
static const bool collectMax = CollectMax;
static const mathic::GeobucketBucketStorage bucketStorage =
static constexpr bool trackFront = TrackFront;
static constexpr bool minBucketBinarySearch = MinBucketBinarySearch;
static constexpr bool premerge = Premerge;
static constexpr bool collectMax = CollectMax;
static constexpr mathic::GeobucketBucketStorage bucketStorage =
(mathic::GeobucketBucketStorage)BucketStorage;
static const size_t insertFactor = InsertFactor;
static constexpr size_t insertFactor = InsertFactor;
};

template<
Expand Down
2 changes: 1 addition & 1 deletion src/pqsim/HeapModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

template<bool FastIndex>
struct HeapModelBase {
static const bool fastIndex = FastIndex;
static constexpr bool fastIndex = FastIndex;
};

template<bool OnSpans, bool Deduplicate, bool FastIndex>
Expand Down
2 changes: 1 addition & 1 deletion src/pqsim/Model.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Model {
std::vector<Entry>& getPending() {return _pending;}
size_t getComparisons() const {return _comparisons;}

static const bool supportDeduplication = Deduplicate;
static constexpr bool supportDeduplication = Deduplicate;

private:
mutable size_t _comparisons;
Expand Down
2 changes: 1 addition & 1 deletion src/pqsim/TourTreeModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

template<bool FastIndex>
struct TourTreeModelBase {
static const bool fastIndex = FastIndex;
static constexpr bool fastIndex = FastIndex;
};

template<bool OnSpans, bool FastIndex>
Expand Down
7 changes: 3 additions & 4 deletions src/test/PairQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace mathic {
namespace PairQueueNamespace {
template<>
struct SupportRetirement<PQConf> {
static bool const value = false;
static constexpr bool value = false;
};
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ namespace mathic {

template<>
struct SupportRetirement<PQConDeconCounterConf> {
static bool const value = true;
static constexpr bool value = true;
};
}
}
Expand Down Expand Up @@ -396,8 +396,7 @@ TEST(PairQueue, ConDeconOfPairData) {
}

TEST(PairQueue, RetirementSetToTrue) {
// This test gives an undesigned symbol in the linker now
// ASSERT_TRUE(mathic::PairQueue<PQConDeconCounterConf>::SupportRetirement);
ASSERT_TRUE(mathic::PairQueue<PQConDeconCounterConf>::SupportRetirement);
mathic::PairQueue<PQConDeconCounterConf> pq((PQConDeconCounterConf()));
pq.configuration().owningQueue = &pq;
mathic::PairQueue<PQConf>::Index* null = 0;
Expand Down
Loading