1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once


#include <string><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <iterator><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <algorithm><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.


#include "internal/dev_env.hpp"


namespace uni {


template<std::input_iterator I, std::sentinel_for<I> S, class Res = std::string>
Res to_lower(I first, S last) noexcept(NO_EXCEPT) {
    Res res;
    res.reserve(std::ranges::distance(first, last));
    std::ranges::transform(first, last, std::back_inserter(res), ::tolower);
    return res;
}

template<std::input_iterator I, std::sentinel_for<I> S, class Res = std::string>
Res to_uppwer(I first, S last) noexcept(NO_EXCEPT) {
    Res res;
    res.reserve(std::ranges::distance(first, last));
    std::ranges::transform(first, last, std::back_inserter(res), ::toupper);
    return res;
}


template<class Res = std::string>
Res to_lower(const std::string str) noexcept(NO_EXCEPT) {<--- Function parameter 'str' should be passed by const reference.
    return to_lower<std::string::const_iterator, std::string::const_iterator, Res>(std::begin(str), std::end(str));
}

template<class Res = std::string>
Res to_uppwer(const std::string str) noexcept(NO_EXCEPT) {<--- Function parameter 'str' should be passed by const reference.
    return to_uppwer<std::string::const_iterator, std::string::const_iterator, Res>(std::begin(str), std::end(str));
}


} // namespace uni