[libcxx-commits] [PATCH] D128146: [libc++] Use uninitialized algorithms for vector

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 4 02:18:26 PDT 2022


philnik added a comment.

@eaeltsin I'm not sure your code is supposed to work. It breaks every iterator wrapper AFAICT. The correct way to add an `operator!=` is to

1. change lines 15-18 to

  template <typename T>
  inline bool operator!=(const REAL_TYPEDEF<T>& lhs, const REAL_TYPEDEF<T>& rhs) {
    return !(lhs == rhs);
  }

2. add

  inline bool operator!=(const REAL_TYPEDEF<B>& rhs) const {
    return !(*this == rhs);
  }

to `REAL_TYPEDEF`

3. use some library that adds it through CRTP, or
4. use C++20

@vitalybuka This isn't unexpected. `-fno-inline` disables inlining, which is essential for a lot of other optimizations. Using `-fno-inline` pretty much defeats the optimizer: https://godbolt.org/z/zrE5o1WK1.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128146



More information about the libcxx-commits mailing list