Commit 7015978b authored by Dominik Charousset's avatar Dominik Charousset

Fix C++17 deprecation warning

parent 161e554b
......@@ -91,8 +91,13 @@ namespace caf::detail {
namespace {
struct columns_iterator
: std::iterator<std::forward_iterator_tag, vector<string>> {
struct columns_iterator {
using iterator_category = std::forward_iterator_tag;
using value_type = std::vector<string>;
using difference_type = ptrdiff_t;
using pointer = value_type*;
using reference = value_type&;
columns_iterator(ifstream* s = nullptr) : fs(s) {
// nop
}
......@@ -127,11 +132,12 @@ std::string get_root_uuid() {
ifstream fs;
fs.open("/etc/fstab", std::ios_base::in);
columns_iterator end;
auto i = find_if(columns_iterator{&fs}, end, [](const vector<string>& cols) {
return cols.size() == 6 && cols[1] == "/";
});
auto i = std::find_if(columns_iterator{&fs}, end,
[](const vector<string>& cols) {
return cols.size() == 6 && cols[1] == "/";
});
if (i != end) {
uuid = move((*i)[0]);
uuid = std::move((*i)[0]);
const char cstr[] = {"UUID="};
auto slen = sizeof(cstr) - 1;
if (uuid.compare(0, slen, cstr) == 0) {
......@@ -139,7 +145,7 @@ std::string get_root_uuid() {
}
// UUIDs are formatted as 8-4-4-4-12 hex digits groups
auto cpy = uuid;
replace_if(cpy.begin(), cpy.end(), ::isxdigit, 'F');
std::replace_if(cpy.begin(), cpy.end(), ::isxdigit, 'F');
// discard invalid UUID
if (cpy != uuid_format) {
uuid.clear();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment