types/tagged: prefer forward to move
This commit is contained in:
parent
d124fffcb3
commit
c3840f05b8
@ -55,7 +55,7 @@ namespace cruft {
|
||||
template <typename InitialT>
|
||||
tagged (InitialT &&initial)
|
||||
{
|
||||
set<InitialT> (std::move (initial));
|
||||
set<InitialT> (std::forward<InitialT> (initial));
|
||||
}
|
||||
|
||||
~tagged () = default;
|
||||
@ -72,7 +72,7 @@ namespace cruft {
|
||||
NextT&
|
||||
operator= (NextT &&next)
|
||||
{
|
||||
return set<NextT> (std::move (next));
|
||||
return set<NextT> (std::forward<NextT> (next));
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ namespace cruft {
|
||||
get (void)&
|
||||
{
|
||||
CHECK (InnerT::tag == m_tag);
|
||||
return *cruft::cast::alignment<InnerT*> (m_data + 0);
|
||||
return *cruft::cast::alignment<std::decay_t<InnerT>*> (m_data + 0);
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ namespace cruft {
|
||||
get (void) const&
|
||||
{
|
||||
CHECK (InnerT::tag == m_tag);
|
||||
return *cruft::cast::alignment<InnerT const*> (m_data + 0);
|
||||
return *cruft::cast::alignment<std::decay_t<InnerT> const*> (m_data + 0);
|
||||
}
|
||||
|
||||
|
||||
@ -113,7 +113,7 @@ namespace cruft {
|
||||
set (InnerT &&inner)&
|
||||
{
|
||||
m_tag = inner.tag;
|
||||
return get<InnerT> () = std::move (inner);
|
||||
return *cruft::cast::alignment<std::decay_t<InnerT>*> (m_data + 0) = std::forward<InnerT> (inner);
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user