Browse Source

move operations are 'noexcept'. implement copy_out() for stringpair and message.

master
roker 4 years ago
parent
commit
f1179d91da
  1. 11
      src/types.cc
  2. 4
      src/wrapper.hh

11
src/types.cc

@ -48,6 +48,12 @@ namespace pEp
free_message(m); free_message(m);
} }
template<>
::message* Wrapper<::message*>::copy_out() const
{
return ::message_dup(value);
}
//////////////// ////////////////
template<> template<>
@ -85,6 +91,11 @@ namespace pEp
free_stringpair(sp); free_stringpair(sp);
} }
template<>
::stringpair_t* Wrapper<::stringpair_t*>::copy_out() const
{
return ::stringpair_dup(value);
}
template<> template<>
void Wrapper<::stringpair_list_t*>::_free(::stringpair_list_t* spl) void Wrapper<::stringpair_list_t*>::_free(::stringpair_list_t* spl)

4
src/wrapper.hh

@ -63,13 +63,13 @@ public:
Wrapper(Args... args) : value{ this->_new(args...) } {} Wrapper(Args... args) : value{ this->_new(args...) } {}
// move is easy, efficient and generic: // move is easy, efficient and generic:
Wrapper(Wrapper<T*>&& victim) Wrapper(Wrapper<T*>&& victim) noexcept
: value{ victim.value} : value{ victim.value}
{ {
victim.value = nullptr; victim.value = nullptr;
} }
Wrapper<T*>& operator=(Wrapper<T*>&& victim) Wrapper<T*>& operator=(Wrapper<T*>&& victim) noexcept
{ {
_free(value); _free(value);
value = victim.value; value = victim.value;

Loading…
Cancel
Save