Skip to content

Commit

Permalink
Merge pull request #54 from bluescarni/pr/noexcept_improve
Browse files Browse the repository at this point in the history
Ensure noexcept behaviour during des11n
  • Loading branch information
bluescarni authored Apr 8, 2024
2 parents f0f85ee + 477ba39 commit 0b1d1be
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/tanuki/tanuki.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,12 @@ class TANUKI_VISIBLE wrap : private detail::wrap_storage<IFace, Cfg.static_size,
// Inform the archive of the new address of the value, so that the address tracking
// machinery keeps on working. See:
// https://www.boost.org/doc/libs/1_82_0/libs/serialization/doc/special.html#objecttracking
ar.reset_object_address(this->m_pv_iface->_tanuki_value_ptr(), pv_iface->_tanuki_value_ptr());
//
// NOTE: wrap this into a noexcept lambda so that we ensure we cannot end up
// with a wrap in an intermediate invalid state.
[&]() noexcept {
ar.reset_object_address(this->m_pv_iface->_tanuki_value_ptr(), pv_iface->_tanuki_value_ptr());
}();

// Clean up pv_iface.
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
Expand Down

0 comments on commit 0b1d1be

Please sign in to comment.