当前位置: 首页>>代码示例>>C++>>正文


C++ boost::make_iterator_range方法代码示例

本文整理汇总了C++中boost::make_iterator_range方法的典型用法代码示例。如果您正苦于以下问题:C++ boost::make_iterator_range方法的具体用法?C++ boost::make_iterator_range怎么用?C++ boost::make_iterator_range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost的用法示例。


在下文中一共展示了boost::make_iterator_range方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getAllFilesWithExt

    FileList getAllFilesWithExt(SearchPath dirPath, const std::string &ext) {
        FileList filesPaths;

        for (const auto &path : dirPath) {
            using boost::filesystem::directory_iterator;
            using boost::make_iterator_range;
            boost::filesystem::path directoryPath(path);

            // Make sure that directory exists
            if (!boost::filesystem::exists(directoryPath)) {
                continue;
            }

            // Get a list of files inside the dir that match the extension
            for (const auto &pathName : make_iterator_range(
                     directory_iterator(directoryPath), directory_iterator())) {
                if (!boost::filesystem::is_regular_file(pathName) ||
                    pathName.path().extension() != ext)
                    continue;

                filesPaths.push_back(pathName.path().generic_string());
            }
        }

        return filesPaths;
    }
开发者ID:powderluv,项目名称:OSVR-Core,代码行数:26,代码来源:SearchPath.cpp

示例2: main

int main() {
    using Value = std::pair<box, int>;
    using Tree  = bgi::rtree<Value, bgi::rstar<32> >;

    Tree idx;

    std::vector<point> const points { point {1,10}, point {2,5}, point {5,8}, point {1,2}, point {8,10}, };

    for (size_t i = 0; i < points.size(); ++i)
        idx.insert(Value { boxof(points[i]), i });

    for (auto& entry : make_iterator_range(qbegin(idx, bgi::nearest(point{0,0}, 100)), {}))
        std::cout << bg::dsv(points[entry.second]) << " ";
}
开发者ID:CCJY,项目名称:coliru,代码行数:14,代码来源:main.cpp

示例3: find_in_path

inline boost::optional<std::string>
find_in_path(const std::string &executable) {
  using std::string;
  using boost::is_equal;
  using boost::filesystem::path;
  using boost::make_iterator_range;

  const string PATH = getenv("PATH");

  for (const auto &token : make_iterator_range(
           make_split_iterator(PATH, first_finder(":", is_equal())), {})) {
    const auto full_path = path(token.begin(), token.end()) / executable;
    if (exists(full_path)) {
      return full_path.string();
    }
  }

  return {};
}
开发者ID:oblitum,项目名称:swift-ycm-core,代码行数:19,代码来源:swift-toolset.hpp

示例4: findPlugin

    std::string findPlugin(const std::string &pluginName) {
        auto searchPaths = getPluginSearchPath();
        for (const auto &searchPath : searchPaths) {
            if (!boost::filesystem::exists(searchPath))
                continue;

            using boost::filesystem::directory_iterator;
            using boost::make_iterator_range;

            for (const auto &pluginPathName : make_iterator_range(
                     directory_iterator(searchPath), directory_iterator())) {
                /// Must be a regular file
                /// @todo does this mean symlinks get excluded?
                if (!boost::filesystem::is_regular_file(pluginPathName))
                    continue;

                const auto pluginCandidate =
                    boost::filesystem::path(pluginPathName);

                /// Needs right extension
                if (pluginCandidate.extension().generic_string() !=
                    OSVR_PLUGIN_EXTENSION) {
                    continue;
                }
                const auto pluginBaseName =
                    pluginCandidate.filename().stem().generic_string();
                /// If the name is right or has the manual load suffix, this is
                /// a good one.
                if ((pluginBaseName == pluginName) ||
                    (pluginBaseName ==
                     pluginName + OSVR_PLUGIN_IGNORE_SUFFIX)) {
                    return pluginPathName.path().generic_string();
                }
            }
        }

        return std::string();
    }
开发者ID:powderluv,项目名称:OSVR-Core,代码行数:38,代码来源:SearchPath.cpp


注:本文中的boost::make_iterator_range方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。