oneDPL icon indicating copy to clipboard operation
oneDPL copied to clipboard

Simplify constructor calls

Open SergeyKopienko opened this issue 10 months ago • 0 comments

In this PR we simplify constructor calls in oneDPL code:

  • before:
        if constexpr (std::is_trivial_v<_TargetValueType>)
            __target = std::forward<_SourceT>(__source);
        else
            ::new (std::addressof(__target)) _TargetValueType(std::forward<_SourceT>(__source));
  • after:
        ::new (std::addressof(__target)) _TargetValueType(std::forward<_SourceT>(__source));

We able to make this change because C++ compiler will optimize constructor call for trivial data types.

SergeyKopienko avatar Apr 25 '24 13:04 SergeyKopienko