Skip to content

Commit

Permalink
upgrade to C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravenslofty committed Jan 3, 2024
1 parent e12ab86 commit be25eb8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ foreach(item ${ARCH})
endif()
endforeach()

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
if (MSVC)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121 /wd4996")
Expand Down
35 changes: 30 additions & 5 deletions common/kernel/hashlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ template <typename K, typename T, typename OPS> class dict
using mapped_type = T;
using value_type = std::pair<K, T>;

class const_iterator : public std::iterator<std::forward_iterator_tag, std::pair<K, T>>
class const_iterator
{
friend class dict;

Expand All @@ -377,6 +377,11 @@ template <typename K, typename T, typename OPS> class dict
const_iterator(const dict *ptr, int index) : ptr(ptr), index(index) {}

public:
using iterator_category = std::forward_iterator_tag;
using value_type = std::pair<K, T>;
using difference_type = std::ptrdiff_t;
using pointer = std::pair<K, T>*;
using reference = std::pair<K, T>&;
const_iterator() {}
const_iterator operator++()
{
Expand All @@ -395,7 +400,7 @@ template <typename K, typename T, typename OPS> class dict
const std::pair<K, T> *operator->() const { return &ptr->entries[index].udata; }
};

class iterator : public std::iterator<std::forward_iterator_tag, std::pair<K, T>>
class iterator
{
friend class dict;

Expand All @@ -405,6 +410,11 @@ template <typename K, typename T, typename OPS> class dict
iterator(dict *ptr, int index) : ptr(ptr), index(index) {}

public:
using iterator_category = std::forward_iterator_tag;
using value_type = std::pair<K, T>;
using difference_type = std::ptrdiff_t;
using pointer = std::pair<K, T>*;
using reference = std::pair<K, T>&;
iterator() {}
iterator operator++()
{
Expand Down Expand Up @@ -808,7 +818,7 @@ template <typename K, typename OPS> class pool
}

public:
class const_iterator : public std::iterator<std::forward_iterator_tag, K>
class const_iterator
{
friend class pool;

Expand All @@ -818,6 +828,11 @@ template <typename K, typename OPS> class pool
const_iterator(const pool *ptr, int index) : ptr(ptr), index(index) {}

public:
using iterator_category = std::forward_iterator_tag;
using value_type = K;
using difference_type = std::ptrdiff_t;
using pointer = K*;
using reference = K&;
const_iterator() {}
const_iterator operator++()
{
Expand All @@ -830,7 +845,7 @@ template <typename K, typename OPS> class pool
const K *operator->() const { return &ptr->entries[index].udata; }
};

class iterator : public std::iterator<std::forward_iterator_tag, K>
class iterator
{
friend class pool;

Expand All @@ -840,6 +855,11 @@ template <typename K, typename OPS> class pool
iterator(pool *ptr, int index) : ptr(ptr), index(index) {}

public:
using iterator_category = std::forward_iterator_tag;
using value_type = K;
using difference_type = std::ptrdiff_t;
using pointer = K*;
using reference = K&;
iterator() {}
iterator operator++()
{
Expand Down Expand Up @@ -1035,7 +1055,7 @@ template <typename K, int offset, typename OPS> class idict
pool<K, OPS> database;

public:
class const_iterator : public std::iterator<std::forward_iterator_tag, K>
class const_iterator
{
friend class idict;

Expand All @@ -1045,6 +1065,11 @@ template <typename K, int offset, typename OPS> class idict
const_iterator(const idict &container, int index) : container(container), index(index) {}

public:
using iterator_category = std::forward_iterator_tag;
using value_type = K;
using difference_type = std::ptrdiff_t;
using pointer = K*;
using reference = K&;
const_iterator() {}
const_iterator operator++()
{
Expand Down

0 comments on commit be25eb8

Please sign in to comment.