Skip to content

Fix for ancient min/max macros in windows.h #3

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

Merged
merged 1 commit into from
Nov 23, 2015
Merged
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
16 changes: 14 additions & 2 deletions peglib.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
#include <unordered_map>
#include <vector>

// guard for older versions of VC++
#ifdef _MSC_VER
// VS2013 has no constexpr
#if (_MSC_VER == 1800)
#define PEGLIB_NO_CONSTEXPR_SUPPORT
#elif (_MSC_VER >= 1800)
// good to go
#else (_MSC_VER < 1800)
#error "Requires C+11 support"
#endif
#endif

namespace peg {

extern void* enabler;
Expand Down Expand Up @@ -2479,7 +2491,7 @@ class peg_token_iterator : public std::iterator<std::forward_iterator_tag, match
peg_token_iterator()
: s_(nullptr)
, l_(0)
, pos_(std::numeric_limits<size_t>::max()) {}
, pos_((std::numeric_limits<size_t>::max)()) {}

peg_token_iterator(const char* syntax, const char* s)
: peg_(syntax)
Expand Down Expand Up @@ -2534,7 +2546,7 @@ class peg_token_iterator : public std::iterator<std::forward_iterator_tag, match
m_.matches.insert(m_.matches.begin(), match::Item{ s_ + mpos, mlen, 0 });
pos_ += mpos + mlen;
} else {
pos_ = std::numeric_limits<size_t>::max();
pos_ = (std::numeric_limits<size_t>::max)();
}
}

Expand Down