markdown 如何对矢量进行排序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 如何对矢量进行排序相关的知识,希望对你有一定的参考价值。

# How to sort std::vectors

This is an example of how to sort file paths taking into accounta an alphabetical order.
```
// Sort the file list
  std::sort(std::begin(filePathList), std::end(filePathList),
      [](const std::string & lhs, const std::string & rhs) {
          if (lhs.size() < rhs.size()) {
              return true;
          } else if (lhs.size() > rhs.size()) {
              return false;
          } else {
              return fs::path(lhs).filename() <
                      fs::path(rhs).filename();
          }
      });
```

以上是关于markdown 如何对矢量进行排序的主要内容,如果未能解决你的问题,请参考以下文章