【问题标题】:Conflict between boost:type_erasure and boost::iterator_facadeboost:type_erasure 和 boost::iterator_facade 之间的冲突
【发布时间】:2015-07-26 16:41:16
【问题描述】:

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

#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.57 上失败,适用于 1.55。
  • 有没有办法在 1.57 中变通?
  • 这应该被简单地报告为一个错误。

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


【解决方案1】:

临时解决办法是替换

struct use_default;

在 `boost/type_erasure/is_placeholder.hpp' 中

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

在 `boost/iterator/iterator_adaptor.hpp' 中找到。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-27
    • 2012-03-06
    • 2011-05-02
    • 2012-11-25
    • 2013-10-27
    • 2014-03-02
    相关资源
    最近更新 更多