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

Fix C++17 deprecation warning

parent 161e554b
...@@ -91,8 +91,13 @@ namespace caf::detail { ...@@ -91,8 +91,13 @@ namespace caf::detail {
namespace { namespace {
struct columns_iterator struct columns_iterator {
: std::iterator<std::forward_iterator_tag, vector<string>> { 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) { columns_iterator(ifstream* s = nullptr) : fs(s) {
// nop // nop
} }
...@@ -127,11 +132,12 @@ std::string get_root_uuid() { ...@@ -127,11 +132,12 @@ std::string get_root_uuid() {
ifstream fs; ifstream fs;
fs.open("/etc/fstab", std::ios_base::in); fs.open("/etc/fstab", std::ios_base::in);
columns_iterator end; columns_iterator end;
auto i = find_if(columns_iterator{&fs}, end, [](const vector<string>& cols) { auto i = std::find_if(columns_iterator{&fs}, end,
return cols.size() == 6 && cols[1] == "/"; [](const vector<string>& cols) {
}); return cols.size() == 6 && cols[1] == "/";
});
if (i != end) { if (i != end) {
uuid = move((*i)[0]); uuid = std::move((*i)[0]);
const char cstr[] = {"UUID="}; const char cstr[] = {"UUID="};
auto slen = sizeof(cstr) - 1; auto slen = sizeof(cstr) - 1;
if (uuid.compare(0, slen, cstr) == 0) { if (uuid.compare(0, slen, cstr) == 0) {
...@@ -139,7 +145,7 @@ std::string get_root_uuid() { ...@@ -139,7 +145,7 @@ std::string get_root_uuid() {
} }
// UUIDs are formatted as 8-4-4-4-12 hex digits groups // UUIDs are formatted as 8-4-4-4-12 hex digits groups
auto cpy = uuid; auto cpy = uuid;
replace_if(cpy.begin(), cpy.end(), ::isxdigit, 'F'); std::replace_if(cpy.begin(), cpy.end(), ::isxdigit, 'F');
// discard invalid UUID // discard invalid UUID
if (cpy != uuid_format) { if (cpy != uuid_format) {
uuid.clear(); 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