mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 07:43:33 +08:00
try_implicit_cast<>() supports non default constructible target types
This commit is contained in:
@@ -101,10 +101,17 @@ struct TryImplicitCastImpl
|
||||
};
|
||||
|
||||
template <typename To, typename From>
|
||||
To try_implicit_cast(const From& from, const To& default_ = To())
|
||||
To try_implicit_cast(const From& from, const To& default_)
|
||||
{
|
||||
return TryImplicitCastImpl<From, To>::impl(from, default_,
|
||||
BooleanType<IsImplicitlyConvertibleFromTo<From, To>::Result>());
|
||||
}
|
||||
|
||||
template <typename To, typename From>
|
||||
To try_implicit_cast(const From& from)
|
||||
{
|
||||
return TryImplicitCastImpl<From, To>::impl(from, To(),
|
||||
BooleanType<IsImplicitlyConvertibleFromTo<From, To>::Result>());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user