There are no comparison operators for directory_entry.

Consider the following program:

#include <iostream>
#include "boost/filesystem.hpp"

int main()
{
    boost::filesystem::directory_entry d("test.txt");
    boost::filesystem::directory_entry e("test.txt");

    if (d == e) { // <---- error C2784
        std::cout << "equal" << std::endl;
    }

    return 0;
}

This fails to compile (Visual Studio 2005, Windows XP SP3) with 17 variants of this error:

error C2784: 'bool std::operator ==(const std::stack<_Ty,_Container> &,
                                    const std::stack<_Ty,_Container> &)' : 
              could not deduce template argument for 
              'const std::stack<_Ty,_Container> &' from 
              'boost::filesystem::directory_entry'

According to the documentation (I still use Boost 1.45), there are comparison operators defined for directory_entry, but neither I nor the compiler can find them (I checked the headers manually). Am I missing something? Maybe I made a mistake when creating boost, perhaps by setting some parameter that disables these operators? Invalid documentation? Can someone explain?

+3
source share
2 answers

, , . BOOST_FILESYSTEM_VERSION 3 .

0

, , ? Boost 1.45 operations.hpp.

0

All Articles