Skip to content

Commit

Permalink
Some fixes for noexcept specifications
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Feb 28, 2024
1 parent 5ffcd17 commit 4418f46
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/openPMD/backend/Attributable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class Attributable

public:
Attributable();
Attributable(NoInit);
Attributable(NoInit) noexcept;

virtual ~Attributable() = default;

Expand Down
4 changes: 2 additions & 2 deletions include/openPMD/backend/Container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ OPENPMD_protected
m_containerData = other.m_containerData;
}

Container(Container &&other) : Attributable(NoInit())
Container(Container &&other) noexcept : Attributable(NoInit())
{
if (other.m_attri)
{
Expand All @@ -505,7 +505,7 @@ OPENPMD_protected
return *this;
}

Container &operator=(Container &&other)
Container &operator=(Container &&other) noexcept
{
if (other.m_attri)
{
Expand Down
7 changes: 5 additions & 2 deletions include/openPMD/snapshots/RandomAccessIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,13 @@ class RandomAccessIterator
~RandomAccessIterator() override;

RandomAccessIterator(RandomAccessIterator const &other);
RandomAccessIterator(RandomAccessIterator &&other) noexcept;
RandomAccessIterator(RandomAccessIterator &&other) noexcept(
noexcept(iterator_t(std::declval<iterator_t &&>())));

RandomAccessIterator &operator=(RandomAccessIterator const &other);
RandomAccessIterator &operator=(RandomAccessIterator &&other) noexcept;
RandomAccessIterator &
operator=(RandomAccessIterator &&other) noexcept(noexcept(
std::declval<iterator_t>().operator=(std::declval<iterator_t &&>())));

value_type const &operator*() const;
RandomAccessIterator &operator++();
Expand Down
2 changes: 1 addition & 1 deletion src/backend/Attributable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Attributable::Attributable()
}
}

Attributable::Attributable(NoInit)
Attributable::Attributable(NoInit) noexcept
{}

Attribute Attributable::getAttribute(std::string const &key) const
Expand Down
9 changes: 7 additions & 2 deletions src/snapshots/RandomAccessIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ RandomAccessIterator<iterator_t>::RandomAccessIterator(
RandomAccessIterator const &other) = default;
template <typename iterator_t>
RandomAccessIterator<iterator_t>::RandomAccessIterator(
RandomAccessIterator &&other) noexcept = default;
RandomAccessIterator
&&other) noexcept(noexcept(iterator_t(std::declval<iterator_t &&>()))) =
default;
template <typename iterator_t>
RandomAccessIterator<iterator_t> &RandomAccessIterator<iterator_t>::operator=(
RandomAccessIterator const &other) = default;
template <typename iterator_t>
RandomAccessIterator<iterator_t> &RandomAccessIterator<iterator_t>::operator=(
RandomAccessIterator &&other) noexcept = default;
RandomAccessIterator
&&other) noexcept(noexcept(std::declval<iterator_t>().
operator=(std::declval<iterator_t &&>()))) =
default;

template <typename iterator_t>
auto RandomAccessIterator<iterator_t>::operator*() const -> value_type const &
Expand Down

0 comments on commit 4418f46

Please sign in to comment.