lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [PATCH] C++ m11n: range-based for loops


From: Greg Chicares
Subject: Re: [lmi] [PATCH] C++ m11n: range-based for loops
Date: Fri, 13 Jan 2017 16:31:12 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.5.1

On 2017-01-13 15:51, Greg Chicares wrote:
[... after applying both patches in pull/52 ...]
> /opt/lmi/src/lmi[0]$make $coefficiency cgi_tests cli_tests              
> Test common gateway interface:
> make[2]: warning: -jN forced in submake: disabling jobserver mode.
> Test command line interface:
> boost::filesystem::is_directory: "opt": File not found.
>   172 errors

Reverting the change to 'ce_product_name.cpp' (copied below) fixes that.

I guess boost::filestream::directory_iterator must behave like standard
stream iterators, e.g.:

    std::istream_iterator<std::string> i(iss);
    std::istream_iterator<std::string> const eos;
    for(; i != eos; ++i)

(which neither patch changed), perhaps because end() isn't defined?
Anyway, I think the solution is to revert this and the other changes
that affect directory_iterator.

Here's the patch I reverted:

diff --git a/ce_product_name.cpp b/ce_product_name.cpp
index 09f7466..92c26cc 100644
--- a/ce_product_name.cpp
+++ b/ce_product_name.cpp
@@ -41,15 +41,13 @@ std::vector<std::string> fetch_product_names()
 {
     fs::path path(global_settings::instance().data_directory());
     std::vector<std::string> names;
-    fs::directory_iterator i(path);
-    fs::directory_iterator end_i;
-    for(; i != end_i; ++i)
+    for(fs::path const& p: path)
         {
-        if(is_directory(*i) || ".policy" != fs::extension(*i))
+        if(is_directory(p) || ".policy" != fs::extension(p))
             {
             continue;
             }
-        names.push_back(basename(*i));
+        names.push_back(basename(p));
         }
 
     if(names.empty())




reply via email to

[Prev in Thread] Current Thread [Next in Thread]