[PATCH] D74340: [CodingStandards] Clarify C++ Standard Library usage

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 12:09:31 PST 2020


rjmccall added a comment.

In D74340#1867850 <https://reviews.llvm.org/D74340#1867850>, @jdoerfert wrote:

> In D74340#1867595 <https://reviews.llvm.org/D74340#1867595>, @rjmccall wrote:
>
> > I think I would prefer if this were a somewhat less absolute statement, like:
> >
> > > When both C++ and the LLVM support libraries provide similar functionality,
> > >  and there isn't a specific reason to favor the C++ implementation, it is
> > >  generally preferable to use the LLVM library.  For example, `llvm::DenseMap`
> > >  should almost always be used instead of `std::map` or `std::unordered_map`,
> > >  and `llvm::SmallVector` should usually be used instead of `std::vector`.
>
>
> Instead of
>
>   It is generally
>   preferable to use the LLVM support libraries over the C++ standard library
>   version, especially if any of the specializations is expected to improve
>   performance, e.g., `SmallVector` vs `std::vector`.
>
>
> ?


That's what I was thinking.  What do you think?

>> it'd be a way of pointing people towards the really specialized implementations
> 
> A list of all "specialized" versions of a common data structure would be nice, with trade-offs or use cases.
>  We could link to that from here once it exists.

Any interest on putting that together? :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74340





More information about the llvm-commits mailing list