#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";
}
The above example code use to compile in Xcode but in Xcode 6.3 it fails to compile initializer list for map obj in the beginning of main function. There are no complains with boost headers. Any idea, why?