[libcxx-commits] [PATCH] D128181: [libc++] Make _LIBCPP_DEBUG_RANDOMIZE_RANGE a function

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 20 10:46:54 PDT 2022


Mordante accepted this revision as: Mordante.
Mordante added a comment.

LGTM once the CI passes. I think it would be good for @ldionne to also have a look so I leave the final approval to him.



================
Comment at: libcxx/include/__debug:30
 
-// TODO: Define this as a function instead
-#if defined(_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY)
-# if defined(_LIBCPP_CXX03_LANG)
-#   error Support for unspecified stability is only for C++11 and higher
-# endif
-# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last)                                                         \
-    do {                                                                                                        \
-      if (!__builtin_is_constant_evaluated())                                                                   \
-        std::shuffle(__first, __last, __libcpp_debug_randomizer());                                             \
-    } while (false)
-#else
-# define _LIBCPP_DEBUG_RANDOMIZE_RANGE(__first, __last)                                                         \
-    do {                                                                                                        \
-    } while (false)
+_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Iterator>
----------------
Not your change, but I'm not really fond of this structure, where:
- we include headers
- write code
- include more headers

Is there a reason why we can't move this code below the second set of includes and thus not have a small `namespace std` section?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128181



More information about the libcxx-commits mailing list