[libcxx-commits] [PATCH] D61139: (ABI break) Remove could-be-defaulted SMFs from `stack` and `queue` and `priority_queue`.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 25 12:01:21 PDT 2019


ldionne added a comment.

Could we remove the code while making sure that we keep `queue` & friends non-trivial even when the underlying container is trivial? Something like:

  // in <__config>:
  #if _LIBCPP_ABI_V1
     // This macro controls whether container adapters are always non-trivial, regardless of whether the underlying Container is trivial or not. This impacts ABI because of how trivial types are passed as function arguments.
  #  define _LIBCPP_ABI_CONTAINER_ADAPTERS_ALWAYS_NONTRIVIAL
  #endif
  
  // in <queue>
  template <class T, class Container = deque<T>>
  class queue {
  public:
  #if defined(_LIBCPP_ABI_CONTAINER_ADAPTERS_ALWAYS_NONTRIVIAL)
    ~queue() { }
  #endif
  };

It seems like this achieves the best of both world: the implementation looks nicer, we preserve the ABI (unless you don't care), and we document the whole thing nicely. What do you think?


Repository:
  rCXX libc++

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

https://reviews.llvm.org/D61139





More information about the libcxx-commits mailing list