aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);
}