mercredi 2 novembre 2016

boost string type mismatch

In the followring code,

class MonitorResult {
public:
    void putDir(std::string && dir) { }
};

void listDir(boost::filesystem::path && dir, MonitorResult & result) {

    for(boost::filesystem::directory_iterator it(dir);
        it != boost::filesystem::directory_iterator(); ++it) {
        if(boost::filesystem::is_symlink( it->path()) ) {
            continue;
        }
        else if(boost::filesystem::is_directory(it->path())) {
            result.putDir(it->path().string() );  // Error here
        }
    }
}

error: no matching function for call to MonitorResult::putDir(const string&) candidate is void MonitorResult::putDir(std::string&&)

I am not getting std::string, but just string. How can type error be resolved? Thanks.

Aucun commentaire:

Enregistrer un commentaire