[all-commits] [llvm/llvm-project] d0caa4: [ADT] Backport std::to_underlying from C++23 (#70681)

Vlad Serebrennikov via All-commits all-commits at lists.llvm.org
Mon Oct 30 12:06:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d0caa4eef702f6eda1ce5ab3d72faabb55b15ca9
      https://github.com/llvm/llvm-project/commit/d0caa4eef702f6eda1ce5ab3d72faabb55b15ca9
  Author: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
  Date:   2023-10-30 (Mon, 30 Oct 2023)

  Changed paths:
    M llvm/include/llvm/ADT/STLForwardCompat.h
    M llvm/unittests/ADT/STLForwardCompatTest.cpp

  Log Message:
  -----------
  [ADT] Backport std::to_underlying from C++23 (#70681)

This patch backports a one-liner `std::to_underlying` that came with C++23. This is useful for refactoring unscoped enums into scoped enums, because the latter are not implicitly convertible to integer types.

I followed libc++ implementation, but I consider their testing too heavy for us, so I wrote a simpler set of tests.




More information about the All-commits mailing list