Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify code to support C++17 #1055

Merged
merged 1 commit into from
Mar 12, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 20 additions & 5 deletions contrib/autoboost/autoboost/operators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,20 +884,35 @@ template <class T> struct operators<T, T>
// Iterator helper classes (contributed by Jeremy Siek) -------------------//
// (Input and output iterator helpers contributed by Daryle Walker) -------//
// (Changed to use combined operator classes by Daryle Walker) ------------//
// (Adapted to C++17 by Daniel Frey) --------------------------------------//
template <class Category,
class T,
class Distance = std::ptrdiff_t,
class Pointer = T*,
class Reference = T&>
struct iterator_helper
{
typedef Category iterator_category;
typedef T value_type;
typedef Distance difference_type;
typedef Pointer pointer;
typedef Reference reference;
};

template <class T,
class V,
class D = std::ptrdiff_t,
class P = V const *,
class R = V const &>
struct input_iterator_helper
: input_iteratable<T, P
, autoboost::iterator<std::input_iterator_tag, V, D, P, R
, autoboost::iterator_helper<std::input_iterator_tag, V, D, P, R
> > {};

template<class T>
struct output_iterator_helper
: output_iteratable<T
, autoboost::iterator<std::output_iterator_tag, void, void, void, void
, autoboost::iterator_helper<std::output_iterator_tag, void, void, void, void
> >
{
T& operator*() { return static_cast<T&>(*this); }
Expand All @@ -911,7 +926,7 @@ template <class T,
class R = V&>
struct forward_iterator_helper
: forward_iteratable<T, P
, autoboost::iterator<std::forward_iterator_tag, V, D, P, R
, autoboost::iterator_helper<std::forward_iterator_tag, V, D, P, R
> > {};

template <class T,
Expand All @@ -921,7 +936,7 @@ template <class T,
class R = V&>
struct bidirectional_iterator_helper
: bidirectional_iteratable<T, P
, autoboost::iterator<std::bidirectional_iterator_tag, V, D, P, R
, autoboost::iterator_helper<std::bidirectional_iterator_tag, V, D, P, R
> > {};

template <class T,
Expand All @@ -931,7 +946,7 @@ template <class T,
class R = V&>
struct random_access_iterator_helper
: random_access_iteratable<T, P, D, R
, autoboost::iterator<std::random_access_iterator_tag, V, D, P, R
, autoboost::iterator_helper<std::random_access_iterator_tag, V, D, P, R
> >
{
friend D requires_difference_operator(const T& x, const T& y) {
Expand Down
2 changes: 0 additions & 2 deletions contrib/websocketpp/websocketpp/common/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ namespace lib {
#ifdef _WEBSOCKETPP_CPP11_MEMORY_
using std::shared_ptr;
using std::weak_ptr;
using std::auto_ptr;
using std::enable_shared_from_this;
using std::static_pointer_cast;
using std::make_shared;
Expand All @@ -75,7 +74,6 @@ namespace lib {
#else
using autoboost::shared_ptr;
using autoboost::weak_ptr;
using std::auto_ptr;
using autoboost::enable_shared_from_this;
using autoboost::static_pointer_cast;
using autoboost::make_shared;
Expand Down
3 changes: 1 addition & 2 deletions contrib/websocketpp/websocketpp/utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ struct my_equal {
* Based on code from
* http://stackoverflow.com/questions/3152241/case-insensitive-stdstring-find
*/
struct ci_less : std::binary_function<std::string, std::string, bool> {
struct ci_less {
// case-independent (ci) compare_less binary function
struct nocase_compare
: public std::binary_function<unsigned char,unsigned char,bool>
{
bool operator() (unsigned char const & c1, unsigned char const & c2) const {
return tolower (c1) < tolower (c2);
Expand Down
9 changes: 6 additions & 3 deletions src/autowiring/test/ContextEnumeratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "stdafx.h"
#include <autowiring/ContextEnumerator.h>
#include <algorithm>
#include <random>
#include MEMORY_HEADER
#include STL_UNORDERED_SET

Expand Down Expand Up @@ -110,7 +111,7 @@ TEST_F(ContextEnumeratorTest, VerifyComplexEnumeration) {
// Verify global context structure
auto enumerator = ContextEnumeratorT<NamedContext>(AutoGlobalContext());
size_t globalCount = std::distance(enumerator.begin(), enumerator.end());

ASSERT_EQ(globalCount, 2UL) << "Expected exactly one context in the parent context, found " << globalCount;
}

Expand Down Expand Up @@ -146,7 +147,9 @@ TEST_F(ContextEnumeratorTest, ComplexRemovalInterference) {
children.push_back(AutoCreateContext());

// Shuffle the collection to prevent the order here from being equivalent to the order in the context
std::random_shuffle(children.begin(), children.end());
std::random_device rd;
std::mt19937 gen(rd());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for random_device usage

std::shuffle(children.begin(), children.end(), gen);

// These are the elements actually encountered in the enumeration, held here to prevent expiration in the
// event that we enumerate a context which should have already been evicted
Expand All @@ -158,7 +161,7 @@ TEST_F(ContextEnumeratorTest, ComplexRemovalInterference) {
// Go through the enumeration, the totals should line up by the time we're done:
for(const auto& cur : CurrentContextEnumerator()) {
enumerated.insert(cur);

// Pull off the last element:
auto removed = children.back();
children.pop_back();
Expand Down