1//
2// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
3//
4// Distributed under the Boost Software License, Version 1.0. (See accompanying
5// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// Official repository: https://github.com/boostorg/beast
8//
9
10#ifndef BOOST_BEAST_IMPL_STRING_IPP
11#define BOOST_BEAST_IMPL_STRING_IPP
12
13#include <boost/beast/core/string.hpp>
14#include <boost/beast/core/detail/string.hpp>
15
16#include <algorithm>
17
18namespace boost {
19namespace beast {
20
21bool
22iequals(
23 beast::string_view lhs,
24 beast::string_view rhs)
25{
26 auto n = lhs.size();
27 if(rhs.size() != n)
28 return false;
29 auto p1 = lhs.data();
30 auto p2 = rhs.data();
31 char a, b;
32 // fast loop
33 while(n--)
34 {
35 a = *p1++;
36 b = *p2++;
37 if(a != b)
38 goto slow;
39 }
40 return true;
41slow:
42 do
43 {
44 if( detail::ascii_tolower(c: a) !=
45 detail::ascii_tolower(c: b))
46 return false;
47 a = *p1++;
48 b = *p2++;
49 }
50 while(n--);
51 return true;
52}
53
54bool
55iless::operator()(
56 string_view lhs,
57 string_view rhs) const
58{
59 using std::begin;
60 using std::end;
61 return std::lexicographical_compare(
62 first1: begin(cont&: lhs), last1: end(cont&: lhs), first2: begin(cont&: rhs), last2: end(cont&: rhs),
63 comp: [](char c1, char c2)
64 {
65 return detail::ascii_tolower(c: c1) < detail::ascii_tolower(c: c2);
66 }
67 );
68}
69
70} // beast
71} // boost
72
73#endif
74

source code of boost/libs/beast/include/boost/beast/core/impl/string.ipp