在Xcode 6.3中boost / assign.hpp失败

时间:2015-04-19 16:49:47

标签: c++ boost xcode6.3

#include <boost/range/adaptors.hpp>
#include <boost/assign.hpp>
#include <iostream>
using namespace boost::adaptors;
using namespace boost::assign;

template<int N>
struct factorial
{
    enum {
        value = N * factorial<N-1>::value
    };
};

template<>
struct factorial<0>
{
    enum {
        value = 1
    };

};

int main()
{
    typedef std::map<uint64_t, std::string> map_type;

    map_type const map_obj = {
        { 0x0000000000000401, "one"   },
        { 0x0000000000000002, "two"   },
        { 0x0000000000000003, "three" },
        { 0x0000000000000404, "four"  },
        { 0x0000000000000005, "five"  },
    };

    const int mask_value = 0x000000000000FF00;

    auto func = [](const map_type::value_type& p)
                    {
                        std::cout << " value_type.second: " << p.second << "\n";
                        return (p.first & mask_value) != 0;
                    };

    for(const auto&v : map_obj | filtered(func) | map_values)
    {
        std::cout << " Got: " << v <<"\n" ;
    }
    std::cout << " 5!: " << factorial<5>::value << "\n";
}

上面的示例代码用于在Xcode中编译,但在Xcode 6.3中,它无法在main函数的开头编译map obj的初始化列表。升级头没有抱怨。任何想法,为什么?

1 个答案:

答案 0 :(得分:0)

哦,错误是链接时间错误,我的提升是使用libc ++而不是使用libstdc ++构建的。切换库有效。