boost:type_erasure和boost :: iterator_facade之间的冲突

时间:2015-05-14 21:46:03

标签: c++ boost boost-iterators boost-type-erasure

考虑这个非常简单的程序:

#include <boost/type_erasure/is_placeholder.hpp>
#include <boost/iterator/iterator_adaptor.hpp>

int main()
{
    return 0;
}

无法编译:

  include/boost/type_erasure/is_placeholder.hpp:31:33: error: reference to 'use_default' is ambiguous
    struct is_placeholder< ::boost::use_default> : ::boost::mpl::false_ {};
                                    ^
    include/boost/iterator/iterator_adaptor.hpp:44:18: note: candidate found by name lookup is 'boost::use_default'
    using iterators::use_default;
                     ^
    include/boost/type_erasure/is_placeholder.hpp:21:8: note: candidate found by name lookup is 'boost::use_default'
    struct use_default;
           ^
    1 error generated.

我不想去更改这些头文件。我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

临时解决方案将取代

struct use_default;

在`boost / type_erasure / is_placeholder.hpp&#39;与

namespace iterators {
    struct use_default;
}
using iterators::use_default;

在`boost / iterator / iterator_adaptor.hpp&#39;中找到了。