[PATCH] D55045: Add a version of std::function that includes a few optimizations.

Eric Fiselier via Phabricator reviews at reviews.llvm.org
Mon Dec 3 12:39:32 PST 2018


EricWF added inline comments.


================
Comment at: include/functional:1664
+struct __use_small_storage
+    : public std::integral_constant<
+          bool, sizeof(_Fun) <= sizeof(__storage) &&
----------------
sbenza wrote:
> `_VSTD`.
> There are other uses of `std::` still.
I actually have no idea why `_VSTD::` exists, or why we would ever need it. One day I hope to kill it.

I'm guess we should do w/e the surrounding code does.


================
Comment at: test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/copy_move.pass.cpp:162
         assert(f2.target<Ptr>());
-        LIBCPP_ASSERT(f.target<Ptr>()); // f is unchanged because the target is small
+        // LIBCPP_ASSERT(f.target<Ptr>()); // f is unchanged because the target is small
     }
----------------
Just remove these asserts. I'm not sure how useful they are.

I guess it means we're allowing ourselves to break existing code, but that existing code depended on UB.
I think maybe the asserts were an attempt to establish that the SSO was actually being hit.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55045/new/

https://reviews.llvm.org/D55045





More information about the libcxx-commits mailing list