Is there an effective difference between std::move(*optional)
and *std::move(optional)
? Which one is preferable?
Full example:
#include <optional>
#include <vector>
void foo()
{
std::optional<std::vector<int>> ov = std::vector<int>{};
std::vector<int> v;
v = std::move(*ov);
}
void bar()
{
std::optional<std::vector<int>> ov = std::vector<int>{};
std::vector<int> v;
v = *std::move(ov);
}