Skip to content

Conversation

@david-grs
Copy link
Owner

@maciekgajewski could you have a look at the change? Don't spend too much time looking at the unit tests for now, I need to add more of them. the existing ones don't make too much sense as I should really check thoroughly the cases where copy ctor throw or not, same with move ctor.

Cheers!
David

{
constexpr const bool canThrow =
(std::is_rvalue_reference<_T&&>::value && std::is_nothrow_move_constructible<_T>::value)
|| (std::is_lvalue_reference<_T&&>::value && std::is_nothrow_copy_constructible<_T>::value);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I review my own code I see the condition should be the other way around - I forgot the negation in fromt of the is_nothrow... I will change that.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 97.88% when pulling e82359e on feature/move_if_noexcept into 71b42f6 on master.

detail::static_any::throw_tag,
detail::static_any::nothrow_tag>::type;

assign(std::forward<_T>(t), ThrowTag{});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see how constexpr if could be useful here

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes... !

CallCounter& operator=(CallCounter&&) { ++move_constructions; return *this; }
~CallCounter() { ++destructions; }

CallCounter(CallCounter&&) noexcept(NoExcept) { ++move_constructions; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

};


/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what's wrong with this guy?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a bad unit test - the name does not mean too much, but more importantly UnsafeCopy is not enough. I should add an UnsafeCopy with a noexcept move ctor and one without, to check both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants