Skip to content

Commit

Permalink
fix(userspace/libsinsp): avoid minor warning with recent C++ standard…
Browse files Browse the repository at this point in the history
…s and compilers

An unusual syntax of the declaration of a constructor (`libsinps::events::set<T>()`) raises a
warning when the compiler is gcc-11 and the build is done with C++20.

Signed-off-by: Jason Dellaluce <[email protected]>
Co-authored-by: Federico Aponte <[email protected]>
  • Loading branch information
2 people authored and poiana committed Oct 20, 2023
1 parent 8c2043e commit 29d6baf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions userspace/libsinsp/events/sinsp_events_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class set
}

public:
struct iterator
struct iterator
{
using iterator_category = std::forward_iterator_tag;
using difference_type = std::ptrdiff_t;
Expand All @@ -83,7 +83,7 @@ class set
}
reference operator*() { return m_val; }
pointer operator->() { return &m_val; }
iterator& operator++() { m_index++; set_val(); return *this; }
iterator& operator++() { m_index++; set_val(); return *this; }
iterator operator++(int) { iterator i = *this; ++(*this); return i; }
friend bool operator== (const iterator& a, const iterator& b)
{
Expand All @@ -110,7 +110,7 @@ class set
set(const set&) = default;
set& operator=(set&&) noexcept = default;
set& operator=(const set&) = default;
set<T>() = delete;
set() = delete;

template<typename InputIterator>
static set<T> from(InputIterator first, InputIterator last)
Expand All @@ -128,7 +128,7 @@ class set
{
return from(v.begin(), v.end());
}

template<typename Iterable>
set(const Iterable& v): set(from(v)) { }

Expand Down

0 comments on commit 29d6baf

Please sign in to comment.