Skip to content

Commit 575dd91

Browse files
committed
WIP
1 parent 01eaa3c commit 575dd91

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

include/ccf/ds/nonstd.h

+12-3
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,18 @@ namespace ccf::nonstd
172172

173173
/** These convert strings to upper or lower case, in-place
174174
*/
175-
void to_upper(std::string& s);
176-
177-
void to_lower(std::string& s);
175+
static inline void to_upper(std::string& s)
176+
{
177+
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) {
178+
return std::toupper(c);
179+
});
180+
}
181+
static inline void to_lower(std::string& s)
182+
{
183+
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) {
184+
return std::tolower(c);
185+
});
186+
}
178187

179188
/// Iterate through tuple, calling functor on each element
180189
template <size_t I = 0, typename F, typename... Ts>

src/ds/nonstd.cpp

-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the Apache 2.0 License.
33

4-
#include "ccf/ds/nonstd.h"
5-
64
#include "ds/nonstd.h"
75

86
#include <algorithm>
@@ -14,21 +12,6 @@
1412

1513
namespace ccf::nonstd
1614
{
17-
// Implementations for ccf/ds/nonstd.h
18-
void to_upper(std::string& s)
19-
{
20-
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) {
21-
return std::toupper(c);
22-
});
23-
}
24-
25-
void to_lower(std::string& s)
26-
{
27-
std::transform(s.begin(), s.end(), s.begin(), [](unsigned char c) {
28-
return std::tolower(c);
29-
});
30-
}
31-
3215
// Implementations for ds/nonstd.h
3316
std::string camel_case(
3417
std::string s, bool camel_first, const std::string& separator_regex)

0 commit comments

Comments
 (0)