diff options
author | Richard Walters <rwalters@digitalstirling.com> | 2019-12-02 20:37:23 -0800 |
---|---|---|
committer | Richard Walters <rwalters@digitalstirling.com> | 2019-12-02 20:37:23 -0800 |
commit | cf01ac1f05f1b339882e09ba6fc7748be3f78575 (patch) | |
tree | 635427453fc816160f218ffa235e1cfe30687272 /src | |
parent | 605f42feb57f5ef1f988a62730f65afd9923c417 (diff) |
Support first > last for range constructor of CharacterSet
Diffstat (limited to 'src')
-rw-r--r-- | src/CharacterSet.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/CharacterSet.cpp b/src/CharacterSet.cpp index 5287806..d0b31a4 100644 --- a/src/CharacterSet.cpp +++ b/src/CharacterSet.cpp @@ -9,6 +9,7 @@ #include "CharacterSet.hpp" +#include <algorithm> #include <set> namespace Uri { @@ -51,6 +52,9 @@ namespace Uri { CharacterSet::CharacterSet(char first, char last) : impl_(new Impl) { + if (first > last) { + std::swap(first, last); + } for (char c = first; c < last + 1; ++c) { (void)impl_->charactersInSet.insert(c); } |