aboutsummaryrefslogtreecommitdiff
path: root/src/CharacterSet.cpp
diff options
context:
space:
mode:
authorRichard Walters <rwalters@digitalstirling.com>2019-12-02 20:37:23 -0800
committerRichard Walters <rwalters@digitalstirling.com>2019-12-02 20:37:23 -0800
commitcf01ac1f05f1b339882e09ba6fc7748be3f78575 (patch)
tree635427453fc816160f218ffa235e1cfe30687272 /src/CharacterSet.cpp
parent605f42feb57f5ef1f988a62730f65afd9923c417 (diff)
Support first > last for range constructor of CharacterSet
Diffstat (limited to 'src/CharacterSet.cpp')
-rw-r--r--src/CharacterSet.cpp4
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);
}