Boost fusion/mpl issues after upgrade to a newer version - c++

This is a simplified version of some code I wrote:
#include <iostream>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/contains.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/fusion/include/filter_if.hpp>
#include <boost/fusion/include/for_each.hpp>
#include <boost/fusion/include/map.hpp>
#include <boost/fusion/include/pair.hpp>
#include <boost/fusion/include/io.hpp>
namespace ids{
struct a0{};
struct a1{};
struct a2{};
struct a3{};
};
typedef boost::fusion::map< boost::fusion::pair<ids::a0,int>
, boost::fusion::pair<ids::a1,double>
, boost::fusion::pair<ids::a2,char>
, boost::fusion::pair<ids::a3,long> > map_type;
typedef boost::mpl::vector<ids::a0,ids::a3> vec_ids_type;
template <typename T>
struct get_first
{
typedef typename T::first_type type;
};
typedef boost::fusion::result_of::filter_if<
map_type
, boost::mpl::contains<
vec_ids_type
, get_first<
boost::mpl::placeholders::_1
>
>
>::type view_type;
struct SetToZero
{
template <typename Field>
void operator()(Field & field) const
{
field.second = 0;
}
};
int main() {
map_type m( boost::fusion::make_pair<ids::a0>(1)
, boost::fusion::make_pair<ids::a1>(2.0)
, boost::fusion::make_pair<ids::a2>('a')
, boost::fusion::make_pair<ids::a3>(4)
);
std::cout << m << std::endl;
view_type v(m);
std::cout << v << std::endl;
boost::fusion::for_each(v,SetToZero());
std::cout << m << std::endl;
}
I want to use view_type to set to zero some elements in an instance of map_type. If the key of one element in map_type is in vec_ids_type, then the data corresponding to that element has to be set to zero, which is done by calling the functor SetToZero. For all this to work, T is meant to be a fusion::pair when get_first<T> is instantiated.
This code compiles and runs perfectly using boost 1.40 and g++ 4.4.3. However I tried to recompile my code using newer versions of boost and g++ and I get compilation errors. Although I think it has to do with boost and not with the compiler, I'll also mention the g++ version. First I tried using boost 1.48.0.2 and g++ 4.6.3, then I tried using boost 1.49.0.1 and g++ 4.7.2. Both attempts failed, giving very similar (if not the same) compilation errors. The error messages are:
tests.cpp: In instantiation of ‘struct get_first<ids::a0>’:
/usr/include/boost/mpl/aux_/has_type.hpp:20:1: required from ‘struct boost::mpl::aux::has_type<get_first<ids::a0>, mpl_::bool_<true> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/quote.hpp:32:36: required from ‘struct boost::mpl::quote1<get_first, mpl_::void_>::apply<ids::a0>’
/usr/include/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:36:8: required from ‘struct boost::mpl::apply_wrap1<boost::mpl::quote1<get_first, mpl_::void_>, ids::a0>’
/usr/include/boost/mpl/aux_/preprocessed/gcc/bind.hpp:144:21: [ skipping 16 instantiation contexts ]
/usr/include/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp:101:135: required from ‘struct boost::mpl::aux::iter_fold_if_impl<boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0>, mpl_::na, boost::mpl::always<mpl_::bool_<false> > >’
/usr/include/boost/mpl/iter_fold_if.hpp:81:12: required from ‘struct boost::mpl::iter_fold_if<boost::mpl::vector<ids::a0, ids::a3>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>::result_’
/usr/include/boost/mpl/iter_fold_if.hpp:104:11: required from ‘struct boost::mpl::iter_fold_if<boost::mpl::vector<ids::a0, ids::a3>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>’
/usr/include/boost/mpl/find_if.hpp:39:17: required from ‘struct boost::mpl::find_if<boost::mpl::vector<ids::a0, ids::a3>, boost::mpl::same_as<get_first<mpl_::arg<1> > > >’
/usr/include/boost/mpl/find.hpp:28:8: required from ‘struct boost::mpl::find<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
/usr/include/boost/mpl/aux_/contains_impl.hpp:33:54: required from ‘struct boost::mpl::contains_impl<boost::mpl::aux::vector_tag>::apply<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
/usr/include/boost/mpl/contains.hpp:30:8: required from ‘struct boost::mpl::contains<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
tests.cpp:70:16: required from here
tests.cpp:37:34: error: no type named ‘first_type’ in ‘struct ids::a0’
In file included from /usr/include/boost/mpl/assert.hpp:17:0,
from /usr/include/boost/mpl/aux_/na_assert.hpp:23,
from /usr/include/boost/mpl/arg.hpp:25,
from /usr/include/boost/mpl/placeholders.hpp:24,
from /usr/include/boost/mpl/apply.hpp:24,
from /usr/include/boost/mpl/aux_/iter_apply.hpp:17,
from /usr/include/boost/mpl/aux_/find_if_pred.hpp:14,
from /usr/include/boost/mpl/find_if.hpp:17,
from /usr/include/boost/mpl/find.hpp:17,
from /usr/include/boost/mpl/aux_/contains_impl.hpp:20,
from /usr/include/boost/mpl/contains.hpp:20,
from tests.cpp:12:
/usr/include/boost/mpl/not.hpp: In instantiation of ‘struct boost::mpl::not_<boost::mpl::aux::iter_apply1<boost::mpl::same_as<get_first<mpl_::arg<1> > >, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> > >’:
/usr/include/boost/mpl/aux_/nested_type_wknd.hpp:26:31: required from ‘struct boost::mpl::aux::nested_type_wknd<boost::mpl::apply1<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> > >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/and.hpp:23:8: required from ‘struct boost::mpl::aux::and_impl<true, boost::mpl::apply1<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/and.hpp:48:8: required from ‘struct boost::mpl::and_<boost::mpl::not_<boost::is_same<boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> > >, boost::mpl::apply1<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >’
/usr/include/boost/mpl/iter_fold_if.hpp:40:58: required from ‘struct boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >::apply<void, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:46:8: required from ‘struct boost::mpl::apply_wrap2<boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0>, void, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/apply.hpp:67:8: [ skipping 4 instantiation contexts ]
/usr/include/boost/mpl/iter_fold_if.hpp:104:11: required from ‘struct boost::mpl::iter_fold_if<boost::mpl::vector<ids::a0, ids::a3>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>’
/usr/include/boost/mpl/find_if.hpp:39:17: required from ‘struct boost::mpl::find_if<boost::mpl::vector<ids::a0, ids::a3>, boost::mpl::same_as<get_first<mpl_::arg<1> > > >’
/usr/include/boost/mpl/find.hpp:28:8: required from ‘struct boost::mpl::find<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
/usr/include/boost/mpl/aux_/contains_impl.hpp:33:54: required from ‘struct boost::mpl::contains_impl<boost::mpl::aux::vector_tag>::apply<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
/usr/include/boost/mpl/contains.hpp:30:8: required from ‘struct boost::mpl::contains<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
tests.cpp:70:16: required from here
/usr/include/boost/mpl/not.hpp:39:8: error: ‘value’ is not a member of ‘boost::mpl::aux::nested_type_wknd<boost::mpl::aux::iter_apply1<boost::mpl::same_as<get_first<mpl_::arg<1> > >, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> > >’
In file included from /usr/include/boost/mpl/aux_/include_preprocessed.hpp:37:0,
from /usr/include/boost/mpl/and.hpp:42,
from /usr/include/boost/mpl/logical.hpp:18,
from /usr/include/boost/mpl/iter_fold_if.hpp:19,
from /usr/include/boost/mpl/find_if.hpp:19,
from /usr/include/boost/mpl/find.hpp:17,
from /usr/include/boost/mpl/aux_/contains_impl.hpp:20,
from /usr/include/boost/mpl/contains.hpp:20,
from tests.cpp:12:
/usr/include/boost/mpl/aux_/preprocessed/gcc/and.hpp: In instantiation of ‘struct boost::mpl::aux::and_impl<true, boost::mpl::apply1<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >’:
/usr/include/boost/mpl/aux_/preprocessed/gcc/and.hpp:48:8: required from ‘struct boost::mpl::and_<boost::mpl::not_<boost::is_same<boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> > >, boost::mpl::apply1<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >’
/usr/include/boost/mpl/iter_fold_if.hpp:40:58: required from ‘struct boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >::apply<void, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:46:8: required from ‘struct boost::mpl::apply_wrap2<boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0>, void, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/apply.hpp:67:8: required from ‘struct boost::mpl::apply2<boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0>, void, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp:62:63: required from ‘struct boost::mpl::aux::iter_fold_if_forward_step<boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp:101:135: [ skipping 2 instantiation contexts ]
/usr/include/boost/mpl/iter_fold_if.hpp:104:11: required from ‘struct boost::mpl::iter_fold_if<boost::mpl::vector<ids::a0, ids::a3>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>’
/usr/include/boost/mpl/find_if.hpp:39:17: required from ‘struct boost::mpl::find_if<boost::mpl::vector<ids::a0, ids::a3>, boost::mpl::same_as<get_first<mpl_::arg<1> > > >’
/usr/include/boost/mpl/find.hpp:28:8: required from ‘struct boost::mpl::find<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
/usr/include/boost/mpl/aux_/contains_impl.hpp:33:54: required from ‘struct boost::mpl::contains_impl<boost::mpl::aux::vector_tag>::apply<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
/usr/include/boost/mpl/contains.hpp:30:8: required from ‘struct boost::mpl::contains<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
tests.cpp:70:16: required from here
/usr/include/boost/mpl/aux_/preprocessed/gcc/and.hpp:23:8: error: ‘value’ is not a member of ‘boost::mpl::aux::nested_type_wknd<boost::mpl::apply1<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> > >’
In file included from /usr/include/boost/mpl/aux_/include_preprocessed.hpp:37:0,
from /usr/include/boost/mpl/aux_/iter_fold_if_impl.hpp:32,
from /usr/include/boost/mpl/iter_fold_if.hpp:25,
from /usr/include/boost/mpl/find_if.hpp:19,
from /usr/include/boost/mpl/find.hpp:17,
from /usr/include/boost/mpl/aux_/contains_impl.hpp:20,
from /usr/include/boost/mpl/contains.hpp:20,
from tests.cpp:12:
/usr/include/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp: In instantiation of ‘struct boost::mpl::aux::iter_fold_if_forward_step<boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0> >’:
/usr/include/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp:101:135: required from ‘struct boost::mpl::aux::iter_fold_if_impl<boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0>, mpl_::na, boost::mpl::always<mpl_::bool_<false> > >’
/usr/include/boost/mpl/iter_fold_if.hpp:81:12: required from ‘struct boost::mpl::iter_fold_if<boost::mpl::vector<ids::a0, ids::a3>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>::result_’
/usr/include/boost/mpl/iter_fold_if.hpp:104:11: required from ‘struct boost::mpl::iter_fold_if<boost::mpl::vector<ids::a0, ids::a3>, void, mpl_::arg<1>, boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, mpl_::na, mpl_::na>’
/usr/include/boost/mpl/find_if.hpp:39:17: required from ‘struct boost::mpl::find_if<boost::mpl::vector<ids::a0, ids::a3>, boost::mpl::same_as<get_first<mpl_::arg<1> > > >’
/usr/include/boost/mpl/find.hpp:28:8: required from ‘struct boost::mpl::find<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
/usr/include/boost/mpl/aux_/contains_impl.hpp:33:54: required from ‘struct boost::mpl::contains_impl<boost::mpl::aux::vector_tag>::apply<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
/usr/include/boost/mpl/contains.hpp:30:8: required from ‘struct boost::mpl::contains<boost::mpl::vector<ids::a0, ids::a3>, get_first<mpl_::arg<1> > >’
tests.cpp:70:16: required from here
/usr/include/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp:62:63: error: no type named ‘type’ in ‘struct boost::mpl::apply2<boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0>, void, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp:65:78: error: no type named ‘type’ in ‘struct boost::mpl::apply2<boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::mpl::aux::find_if_pred<boost::mpl::same_as<get_first<mpl_::arg<1> > > >, 0>, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 2l> >, 0>, void, boost::mpl::v_iter<boost::mpl::vector<ids::a0, ids::a3>, 0l> >’
tests.cpp: In instantiation of ‘struct get_first<mpl_::arg<1> >’:
tests.cpp:70:16: required from here
tests.cpp:37:34: error: no type named ‘first_type’ in ‘struct mpl_::arg<1>’
From the very first line of the error messages there is something completely unexpected for me tests.cpp: In instantiation of ‘struct get_first<ids::a0>’. This should not happen because get_first should only be instantiated using elements of map_type, i.e. fusion::pair. I really don't understand why this is happening.
As I said, it works perfectly with boost 1.40, and it makes a lot of sense for me as it is written now, so I really don't see where the error is. My only guess is that something might have changed in the newer versions of fusion or mpl that is causing this. Actually I checked the change logs of Boost.Fusion and Boost and something related to fusion views have been modified/added. Maybe a bug? or, Am I missing something? why it does not work with the newer versions of boost that I tried?
thanks in advance!

Using:
typedef boost::fusion::result_of::filter_if<
map_type
,
boost::mpl::lambda<
boost::mpl::contains<
vec_ids_type
,
get_first<
boost::mpl::_1
>
>
>::type
>::type view_type;
Seems to make it work as you can see here. Currently LiveWorkspace uses boost 1.53.0.

Related

Compiling simple Boost Process code fails

I'm trying to implement a platform-independent function (working on Windows/Linux/Mac OS X) for calling an external process using boost/process.hpp as follows:
#include <sstream>
#include <boost/process.hpp>
std::string execute_external_process(const std::string &command,
const std::vector<std::string> &arguments) {
boost::process::ipstream out;
boost::process::child child(boost::process::search_path(command), arguments,
boost::process::std_out > out, boost::process::std_err > out);
std::stringstream process_output_builder;
std::string line;
while (child.running() && std::getline(out, line) && !line.empty()) {
process_output_builder << line;
process_output_builder << "\n";
}
child.wait();
return process_output_builder.str();
}
However, I'm getting the following Boost compilation error:
In file included from /usr/include/boost/process/async.hpp:35,
from /usr/include/boost/process.hpp:23,
from ../src/ExternalProcessUtils.cpp:4:
/bin/vcpkg/installed/x64-linux/include/boost/asio/io_service.hpp:27:20: error: conflicting declaration ‘typedef class boost::asio::io_context boost::asio::io_service’
27 | typedef io_context io_service;
| ^~~~~~~~~~
In file included from /usr/include/boost/process/detail/traits.hpp:11,
from /usr/include/boost/process/async.hpp:32,
from /usr/include/boost/process.hpp:23,
from ../src/ExternalProcessUtils.cpp:4:
/usr/include/boost/process/detail/traits/async.hpp:15:7: note: previous declaration as ‘class boost::asio::io_service’
15 | class io_service;
| ^~~~~~~~~~
In file included from /usr/include/c++/10/bits/move.h:57,
from /usr/include/c++/10/bits/stl_pair.h:59,
from /usr/include/c++/10/bits/stl_algobase.h:64,
from /usr/include/c++/10/vector:60,
from ../src/ExternalProcessUtils.hpp:3,
from ../src/ExternalProcessUtils.cpp:1:
/usr/include/c++/10/type_traits: In instantiation of ‘struct std::is_base_of<boost::asio::execution::detail::any_executor_base, boost::asio::io_service>’:
/bin/vcpkg/installed/x64-linux/include/boost/asio/execution/any_executor.hpp:1400:66: required by substitution of ‘template<class Executor> boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > >::any_executor(Executor, typename std::enable_if<typename std::conditional<((! std::is_same<Executor, boost::asio::execution::any_executor<boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> > > >::value) && (! std::is_base_of<boost::asio::execution::detail::any_executor_base, Executor>::value)), boost::asio::execution::detail::is_valid_target_executor<Executor, void(boost::asio::execution::context_as_t<boost::asio::execution_context&>, boost::asio::execution::detail::blocking::never_t<0>, boost::asio::execution::prefer_only<boost::asio::execution::detail::blocking::possibly_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::tracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::outstanding_work::untracked_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::fork_t<0> >, boost::asio::execution::prefer_only<boost::asio::execution::detail::relationship::continuation_t<0> >)>, std::integral_constant<bool, false> >::type::value, void>::type*) [with Executor = boost::asio::io_service]’
/usr/include/boost/process/detail/posix/io_service_ref.hpp:125:63: required from here
/usr/include/c++/10/type_traits:1412:38: error: invalid use of incomplete type ‘class boost::asio::io_service’
1412 | : public integral_constant<bool, __is_base_of(_Base, _Derived)>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/process/detail/traits.hpp:11,
from /usr/include/boost/process/async.hpp:32,
from /usr/include/boost/process.hpp:23,
from ../src/ExternalProcessUtils.cpp:4:
/usr/include/boost/process/detail/traits/async.hpp:15:7: note: forward declaration of ‘class boost::asio::io_service’
15 | class io_service;
| ^~~~~~~~~~
...
I cut the remaining error message off since it is quite lengthy. Since my code seems to look fine I wonder if this is a bug in Boost. I'm using the newest version 1.75.0 but this problem also occurred in version 1.74.0 (hence the reason why I updated).
Any ideas on how this could be fixed?

std::unordered_map<boost::any, boost::any> throws annoying compile errors

When I declare a variable of std::unordered_map<boost::any, boost::any> type, it throws annoying compile errors.
For an example, any.cc:
#include <map>
#include <boost/any.hpp>
int main() {
std::map<boost::any, boost::any> dict;
return 0;
}
Compiling above code as g++ any.cc -std=c++11 -I/usr/include/boost occurs a lot of errors like following:
In file included from /usr/include/c++/5/bits/hashtable.h:35:0,
from /usr/include/c++/5/unordered_map:47,
from any.cc:1:
/usr/include/c++/5/bits/hashtable_policy.h: In instantiation of ‘struct std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> >’:
/usr/include/c++/5/type_traits:137:12: required from ‘struct std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > >’
/usr/include/c++/5/type_traits:148:38: required from ‘struct std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
/usr/include/c++/5/bits/unordered_map.h:100:66: required from ‘class std::unordered_map<boost::any, boost::any>’
any.cc:5:48: required from here
/usr/include/c++/5/bits/hashtable_policy.h:85:34: error: no match for call to ‘(const std::hash<boost::any>) (const boost::any&)’
noexcept(declval<const _Hash&>()(declval<const _Key&>()))>
^
In file included from /usr/include/c++/5/bits/move.h:57:0,
from /usr/include/c++/5/bits/stl_pair.h:59,
from /usr/include/c++/5/utility:70,
from /usr/include/c++/5/unordered_map:38,
from any.cc:1:
/usr/include/c++/5/type_traits: In instantiation of ‘struct std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’:
/usr/include/c++/5/bits/unordered_map.h:100:66: required from ‘class std::unordered_map<boost::any, boost::any>’
any.cc:5:48: required from here
/usr/include/c++/5/type_traits:148:38: error: ‘value’ is not a member of ‘std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > >’
: public integral_constant<bool, !_Pp::value>
^
In file included from /usr/include/c++/5/unordered_map:48:0,
from any.cc:1:
/usr/include/c++/5/bits/unordered_map.h: In instantiation of ‘class std::unordered_map<boost::any, boost::any>’:
any.cc:5:48: required from here
/usr/include/c++/5/bits/unordered_map.h:100:66: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable;
^
/usr/include/c++/5/bits/unordered_map.h:107:45: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::key_type key_type;
^
/usr/include/c++/5/bits/unordered_map.h:108:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::value_type value_type;
^
/usr/include/c++/5/bits/unordered_map.h:109:48: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::mapped_type mapped_type;
^
/usr/include/c++/5/bits/unordered_map.h:110:43: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::hasher hasher;
^
/usr/include/c++/5/bits/unordered_map.h:111:46: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::key_equal key_equal;
^
/usr/include/c++/5/bits/unordered_map.h:112:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::allocator_type allocator_type;
^
/usr/include/c++/5/bits/unordered_map.h:117:45: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::pointer pointer;
^
/usr/include/c++/5/bits/unordered_map.h:118:50: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::const_pointer const_pointer;
^
/usr/include/c++/5/bits/unordered_map.h:119:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::reference reference;
^
/usr/include/c++/5/bits/unordered_map.h:120:52: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::const_reference const_reference;
^
/usr/include/c++/5/bits/unordered_map.h:121:46: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::iterator iterator;
^
/usr/include/c++/5/bits/unordered_map.h:122:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::const_iterator const_iterator;
^
/usr/include/c++/5/bits/unordered_map.h:123:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::local_iterator local_iterator;
^
/usr/include/c++/5/bits/unordered_map.h:124:57: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::const_local_iterator const_local_iterator;
^
/usr/include/c++/5/bits/unordered_map.h:125:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::size_type size_type;
^
/usr/include/c++/5/bits/unordered_map.h:126:52: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
typedef typename _Hashtable::difference_type difference_type;
^
/usr/include/c++/5/bits/unordered_map.h:280:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
operator=(initializer_list<value_type> __l)
^
/usr/include/c++/5/bits/unordered_map.h:379:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
emplace(_Args&&... __args)
^
/usr/include/c++/5/bits/unordered_map.h:432:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
insert(const value_type& __x)
^
/usr/include/c++/5/bits/unordered_map.h:439:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
insert(_Pair&& __x)
^
/usr/include/c++/5/bits/unordered_map.h:499:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
insert(initializer_list<value_type> __l)
^
/usr/include/c++/5/bits/unordered_map.h:645:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
equal_range(const key_type& __x)
^
/usr/include/c++/5/bits/unordered_map.h:649:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<boost::any> >, std::__detail::__is_noexcept_hash<boost::any, std::hash<boost::any> > > >’
equal_range(const key_type& __x) const
^
But when I use boost::unordered_map rather than std, it works without any errors.
Why?
std::unordered_map uses std::hash as default hasher. There is no specialization of std::hash for boost::any. Because STanDard library does not know anything about entity from 3rd party library.
boost::unordered_map uses boost::hash as default hasher, which has specialization for types from boost library.
Solution: explicitely tell std::unordered_map to use boost::hash<boost::any> as hasher.
When you declare an unordered_map<Key, Value>, you need a hashing function. The default hashing function is const hash<Key>(const Key&).
boost::any, it appears, has such hashing template specialization, but for boost::hash.
So in effect the compiler tries to find a specialization for std::hash for boost::any, but finds only boost::hash specialization.

Problems with boost library and c++11

I am trying to learn how boost filesystem work, but I can't get through some compilation problems
#include <boost/filesystem.hpp>
#include <iostream>
using namespace boost::filesystem;
int main()
{
path p = current_path();
directory_iterator it{p};
while (it != directory_iterator{})
std::cout << *it++ << '\n';
}
this is how I try to compile.
My g++ version is 4.7
g++ -std=c++11 filesystem.cc -lboost_filesystem -o filesystem
After this I get thousands of errors.
For example
In file included from /usr/include/boost/iterator/interoperable.hpp:13:0,
from /usr/include/boost/iterator/iterator_facade.hpp:11,
from /usr/include/boost/filesystem/path.hpp:22,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/type_traits/is_convertible.hpp: In instantiation of ‘const bool boost::detail::is_convertible_basic_impl<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >&, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >::value’:
/usr/include/boost/type_traits/is_convertible.hpp:295:5: required from ‘const bool boost::detail::is_convertible_impl<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >::value’
/usr/include/boost/type_traits/is_convertible.hpp:418:1: required from ‘struct boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >’
/usr/include/boost/mpl/aux_/nested_type_wknd.hpp:26:31: required from ‘struct boost::mpl::aux::nested_type_wknd<boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > > >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/or.hpp:48:8: required from ‘struct boost::mpl::or_<boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >, boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >’
/usr/include/boost/iterator/detail/enable_if.hpp:68:12: required from ‘struct boost::iterators::enable_if<boost::mpl::or_<boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >, boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >, bool>’
/usr/include/boost/iterator/iterator_facade.hpp:67:12: required from ‘struct boost::detail::enable_if_interoperable<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >, bool>’
/usr/include/boost/iterator/iterator_facade.hpp:837:3: required by substitution of ‘template<class Derived1, class V1, class TC1, class Reference1, class Difference1, class Derived2, class V2, class TC2, class Reference2, class Difference2> typename boost::detail::enable_if_interoperable<Derived1, Derived2, typename boost::mpl::apply2<boost::detail::always_bool2, Derived1, Derived2>::type>::type boost::operator!=(const boost::iterator_facade<Derived1, V1, TC1, Reference1, Difference1>&, const boost::iterator_facade<Derived2, V2, TC2, Reference2, Difference2>&) [with Derived1 = boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >; V1 = boost::filesystem::basic_directory_entry<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >; TC1 = boost::single_pass_traversal_tag; Reference1 = boost::filesystem::basic_directory_entry<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >&; Difference1 = long int; Derived2 = boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >; V2 = boost::filesystem::basic_directory_entry<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >; TC2 = boost::single_pass_traversal_tag; Reference2 = boost::filesystem::basic_directory_entry<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >&; Difference2 = long int]’
filesystem.cc:10:35: required from here
/usr/include/boost/type_traits/is_convertible.hpp:136:49: error: use of deleted function ‘boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::basic_directory_iterator(const boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >&)’
In file included from /usr/include/boost/filesystem.hpp:16:0,
from filesystem.cc:1:
/usr/include/boost/filesystem/operations.hpp:891:11: note: ‘boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::basic_directory_iterator(const boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/include/boost/filesystem/operations.hpp:891:11: error: use of deleted function ‘boost::shared_ptr<boost::filesystem::detail::dir_itr_imp<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >::shared_ptr(const boost::shared_ptr<boost::filesystem::detail::dir_itr_imp<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >&)’
In file included from /usr/include/boost/shared_ptr.hpp:17:0,
from /usr/include/boost/filesystem/path.hpp:24,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/smart_ptr/shared_ptr.hpp:168:25: note: ‘boost::shared_ptr<boost::filesystem::detail::dir_itr_imp<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >::shared_ptr(const boost::shared_ptr<boost::filesystem::detail::dir_itr_imp<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >&)’ is implicitly declared as deleted because ‘boost::shared_ptr<boost::filesystem::detail::dir_itr_imp<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >’ declares a move constructor or move assignment operator
In file included from /usr/include/boost/iterator/interoperable.hpp:13:0,
from /usr/include/boost/iterator/iterator_facade.hpp:11,
from /usr/include/boost/filesystem/path.hpp:22,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/type_traits/is_convertible.hpp:128:41: error: initializing argument 1 of ‘static boost::type_traits::yes_type boost::detail::checker<T>::_m_check(T, int) [with T = boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >; boost::type_traits::yes_type = char]’
In file included from /usr/include/boost/filesystem/path.hpp:23:0,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/throw_exception.hpp: In instantiation of ‘void boost::throw_exception(const E&) [with E = boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >]’:
/usr/include/boost/filesystem/operations.hpp:280:9: required from ‘typename boost::enable_if<boost::filesystem::is_basic_path<Path>, boost::filesystem::file_status>::type boost::filesystem::symlink_status(const Path&) [with Path = boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits>; typename boost::enable_if<boost::filesystem::is_basic_path<Path>, boost::filesystem::file_status>::type = boost::filesystem::file_status]’
/usr/include/boost/filesystem/operations.hpp:287:45: required from here
/usr/include/boost/throw_exception.hpp:65:56: error: use of deleted function ‘boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > > >::clone_impl(const boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > > >&)’
In file included from /usr/include/boost/throw_exception.hpp:37:0,
from /usr/include/boost/filesystem/path.hpp:23,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/exception/exception.hpp:377:9: note: ‘boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > > >::clone_impl(const boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > > >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/include/boost/exception/exception.hpp:377:9: error: use of deleted function ‘boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >::error_info_injector(const boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >&)’
/usr/include/boost/exception/exception.hpp:287:9: note: ‘boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >::error_info_injector(const boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> > >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/include/boost/exception/exception.hpp:287:9: error: use of deleted function ‘boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::basic_filesystem_error(const boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >&)’
In file included from /usr/include/boost/filesystem/operations.hpp:17:0,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/filesystem/path.hpp:681:11: note: ‘boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::basic_filesystem_error(const boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/include/boost/filesystem/path.hpp:681:11: error: use of deleted function ‘boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::m_imp>::shared_ptr(const boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::m_imp>&)’
In file included from /usr/include/boost/shared_ptr.hpp:17:0,
from /usr/include/boost/filesystem/path.hpp:24,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/smart_ptr/shared_ptr.hpp:168:25: note: ‘boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::m_imp>::shared_ptr(const boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::m_imp>&)’ is implicitly declared as deleted because ‘boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<char>, boost::filesystem::path_traits> >::m_imp>’ declares a move constructor or move assignment operator
In file included from /usr/include/boost/filesystem/path.hpp:23:0,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/throw_exception.hpp: In instantiation of ‘void boost::throw_exception(const E&) [with E = boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >]’:
/usr/include/boost/filesystem/operations.hpp:261:9: required from ‘typename boost::enable_if<boost::filesystem::is_basic_path<Path>, boost::filesystem::file_status>::type boost::filesystem::status(const Path&) [with Path = boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits>; typename boost::enable_if<boost::filesystem::is_basic_path<Path>, boost::filesystem::file_status>::type = boost::filesystem::file_status]’
/usr/include/boost/filesystem/operations.hpp:620:34: required from here
/usr/include/boost/throw_exception.hpp:65:56: error: use of deleted function ‘boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > > >::clone_impl(const boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > > >&)’
In file included from /usr/include/boost/throw_exception.hpp:37:0,
from /usr/include/boost/filesystem/path.hpp:23,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/exception/exception.hpp:377:9: note: ‘boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > > >::clone_impl(const boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > > >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/include/boost/exception/exception.hpp:377:9: error: use of deleted function ‘boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >::error_info_injector(const boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >&)’
/usr/include/boost/exception/exception.hpp:287:9: note: ‘boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >::error_info_injector(const boost::exception_detail::error_info_injector<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/include/boost/exception/exception.hpp:287:9: error: use of deleted function ‘boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >::basic_filesystem_error(const boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >&)’
In file included from /usr/include/boost/filesystem/operations.hpp:17:0,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/filesystem/path.hpp:681:11: note: ‘boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >::basic_filesystem_error(const boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >&)’ is implicitly deleted because the default definition would be ill-formed:
/usr/include/boost/filesystem/path.hpp:681:11: error: use of deleted function ‘boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >::m_imp>::shared_ptr(const boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >::m_imp>&)’
In file included from /usr/include/boost/shared_ptr.hpp:17:0,
from /usr/include/boost/filesystem/path.hpp:24,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/smart_ptr/shared_ptr.hpp:168:25: note: ‘boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >::m_imp>::shared_ptr(const boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >::m_imp>&)’ is implicitly declared as deleted because ‘boost::shared_ptr<boost::filesystem::basic_filesystem_error<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >::m_imp>’ declares a move constructor or move assignment operator
In file included from /usr/include/boost/iterator/interoperable.hpp:13:0,
from /usr/include/boost/iterator/iterator_facade.hpp:11,
from /usr/include/boost/filesystem/path.hpp:22,
from /usr/include/boost/filesystem/operations.hpp:17,
from /usr/include/boost/filesystem.hpp:16,
from filesystem.cc:1:
/usr/include/boost/type_traits/is_convertible.hpp: In instantiation of ‘const bool boost::detail::is_convertible_basic_impl<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >&, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >::value’:
/usr/include/boost/type_traits/is_convertible.hpp:295:5: required from ‘const bool boost::detail::is_convertible_impl<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >::value’
/usr/include/boost/type_traits/is_convertible.hpp:418:1: required from ‘struct boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >’
/usr/include/boost/mpl/aux_/nested_type_wknd.hpp:26:31: required from ‘struct boost::mpl::aux::nested_type_wknd<boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > > >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/or.hpp:48:8: required from ‘struct boost::mpl::or_<boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >, boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >’
/usr/include/boost/iterator/detail/enable_if.hpp:68:12: required from ‘struct boost::iterators::enable_if<boost::mpl::or_<boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >, boost::is_convertible<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> > >, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >, bool>’
/usr/include/boost/iterator/iterator_facade.hpp:67:12: required from ‘struct boost::detail::enable_if_interoperable<boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >, bool>’
/usr/include/boost/iterator/iterator_facade.hpp:837:3: required by substitution of ‘template<class Derived1, class V1, class TC1, class Reference1, class Difference1, class Derived2, class V2, class TC2, class Reference2, class Difference2> typename boost::detail::enable_if_interoperable<Derived1, Derived2, typename boost::mpl::apply2<boost::detail::always_bool2, Derived1, Derived2>::type>::type boost::operator!=(const boost::iterator_facade<Derived1, V1, TC1, Reference1, Difference1>&, const boost::iterator_facade<Derived2, V2, TC2, Reference2,
Difference2>&) [with Derived1 =
further part
boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >; V1 = boost::filesystem::basic_directory_entry<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >; TC1 = boost::single_pass_traversal_tag; Reference1 = boost::filesystem::basic_directory_entry<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >&; Difference1 = long int; Derived2 = boost::filesystem::basic_directory_iterator<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >; V2 = boost::filesystem::basic_directory_entry<boost::filesystem::basic_path<std::basic_string<wchar_t>, boost::filesystem::wpath_traits> >; TC2 = boost::single_pass_traversal_tag; Reference2 =

Creating an std::unordered_map with an std::pair as key

I am trying to create an std::unordered_map with an std::pair as key. As you can imagine, this would require me to explicitly provide a class to generate a hash for a given key, as well as an equality comparator for the keys. Here's my code so far:
#include <unordered_map>
#include <memory>
#include <utility>
template <class T, typename U>
struct PairHash{
size_t operator()(const std::pair<T, U> &key){
return std::hash<T>()(key.first) ^ std::hash<U>()(key.second);
}
};
template <class T, typename U>
struct PairEqual{
bool operator()(const std::pair<T, U> &lhs, const std::pair<T, U> &rhs) const{
return lhs.first == rhs.first && lhs.second == rhs.second;
}
};
struct GraphEdge{
};
int main(){
std::unordered_map<std::pair<int, int>,
std::unique_ptr<GraphEdge>,
PairHash<int, int>,
PairEqual<int, int>> edges;
}
However, this gives me a rather (to my eyes at least) inscrutable compiler error:
In file included from /usr/include/c++/5/bits/hashtable.h:35:0,
from /usr/include/c++/5/unordered_map:47,
from prog.cpp:1:
/usr/include/c++/5/bits/hashtable_policy.h: In instantiation of 'struct std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> >':
/usr/include/c++/5/type_traits:137:12: required from 'struct std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > >'
/usr/include/c++/5/type_traits:148:38: required from 'struct std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
/usr/include/c++/5/bits/unordered_map.h:100:66: required from 'class std::unordered_map<std::pair<int, int>, std::unique_ptr<GraphEdge>, PairHash<int, int>, PairEqual<int, int> >'
prog.cpp:29:43: required from here
/usr/include/c++/5/bits/hashtable_policy.h:85:34: error: no match for call to '(const PairHash<int, int>) (const std::pair<int, int>&)'
noexcept(declval<const _Hash&>()(declval<const _Key&>()))>
^
prog.cpp:7:12: note: candidate: size_t PairHash<T, U>::operator()(const std::pair<_T1, _T2>&) [with T = int; U = int; size_t = unsigned int] <near match>
size_t operator()(const std::pair<T, U> &key){
^
prog.cpp:7:12: note: passing 'const PairHash<int, int>*' as 'this' argument discards qualifiers
In file included from /usr/include/c++/5/bits/move.h:57:0,
from /usr/include/c++/5/bits/stl_pair.h:59,
from /usr/include/c++/5/utility:70,
from /usr/include/c++/5/unordered_map:38,
from prog.cpp:1:
/usr/include/c++/5/type_traits: In instantiation of 'struct std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >':
/usr/include/c++/5/bits/unordered_map.h:100:66: required from 'class std::unordered_map<std::pair<int, int>, std::unique_ptr<GraphEdge>, PairHash<int, int>, PairEqual<int, int> >'
prog.cpp:29:43: required from here
/usr/include/c++/5/type_traits:148:38: error: 'value' is not a member of 'std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > >'
: public integral_constant<bool, !_Pp::value>
^
In file included from /usr/include/c++/5/unordered_map:48:0,
from prog.cpp:1:
/usr/include/c++/5/bits/unordered_map.h: In instantiation of 'class std::unordered_map<std::pair<int, int>, std::unique_ptr<GraphEdge>, PairHash<int, int>, PairEqual<int, int> >':
prog.cpp:29:43: required from here
/usr/include/c++/5/bits/unordered_map.h:100:66: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable;
^
/usr/include/c++/5/bits/unordered_map.h:107:45: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::key_type key_type;
^
/usr/include/c++/5/bits/unordered_map.h:108:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::value_type value_type;
^
/usr/include/c++/5/bits/unordered_map.h:109:48: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::mapped_type mapped_type;
^
/usr/include/c++/5/bits/unordered_map.h:110:43: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::hasher hasher;
^
/usr/include/c++/5/bits/unordered_map.h:111:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::key_equal key_equal;
^
/usr/include/c++/5/bits/unordered_map.h:112:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::allocator_type allocator_type;
^
/usr/include/c++/5/bits/unordered_map.h:117:45: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::pointer pointer;
^
/usr/include/c++/5/bits/unordered_map.h:118:50: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::const_pointer const_pointer;
^
/usr/include/c++/5/bits/unordered_map.h:119:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::reference reference;
^
/usr/include/c++/5/bits/unordered_map.h:120:52: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::const_reference const_reference;
^
/usr/include/c++/5/bits/unordered_map.h:121:46: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::iterator iterator;
^
/usr/include/c++/5/bits/unordered_map.h:122:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::const_iterator const_iterator;
^
/usr/include/c++/5/bits/unordered_map.h:123:51: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::local_iterator local_iterator;
^
/usr/include/c++/5/bits/unordered_map.h:124:57: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::const_local_iterator const_local_iterator;
^
/usr/include/c++/5/bits/unordered_map.h:125:47: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::size_type size_type;
^
/usr/include/c++/5/bits/unordered_map.h:126:52: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
typedef typename _Hashtable::difference_type difference_type;
^
/usr/include/c++/5/bits/unordered_map.h:280:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
operator=(initializer_list<value_type> __l)
^
/usr/include/c++/5/bits/unordered_map.h:379:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
emplace(_Args&&... __args)
^
/usr/include/c++/5/bits/unordered_map.h:432:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
insert(const value_type& __x)
^
/usr/include/c++/5/bits/unordered_map.h:439:2: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
insert(_Pair&& __x)
^
/usr/include/c++/5/bits/unordered_map.h:499:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
insert(initializer_list<value_type> __l)
^
/usr/include/c++/5/bits/unordered_map.h:645:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
equal_range(const key_type& __x)
^
/usr/include/c++/5/bits/unordered_map.h:649:7: error: 'value' is not a member of 'std::__not_<std::__and_<std::__is_fast_hash<PairHash<int, int> >, std::__detail::__is_noexcept_hash<std::pair<int, int>, PairHash<int, int> > > >'
equal_range(const key_type& __x) const
^
What am I doing wrong?
Apparently, libstdc++ refers to your hash object via const PairHash<int, int>*. Thus calling the operator () which is not marked const in your program is a compiler error.
You can get your code to compile with libstdc++ by making operator() const.
As of 17.6.3.4 (Hash Requirements), a Hash type must provide a size_t operator(KeyType) const;, so your code is indeed incorrect.
You need to make the operator() a const method in your custom functors.

Usage of `boost::phoenix::static_cast_` mixed with standard library

It is a Phoenix v3 bug. It compiles with Phoenix v2 just fine.
I did bug report.
I will mark this question as resolved in 2 days. Thank you all.
I am trying to make a short lamba with phoenix, but I get bunch of compile errors. Here is the code.
std::vector<unsigned char> data;
using boost::phoenix::arg_names::_1;
using boost::phoenix::static_cast_;
std::ostringstream oss;
oss << std::hex;
//Doesn't compile
std::for_each(data.begin(),data.end(), oss << static_cast_<unsigned int>(_1) );
//Compiles
std::for_each(data.begin(),data.end(), oss << _1 );
Now I get the following compile error from GCC 4.6.1:
/usr/include/boost/utility/result_of.hpp:-1: In instantiation of ‘boost::detail::result_of_nested_result<boost::phoenix::static_cast_eval, boost::phoenix::static_cast_eval(boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>&, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >&, boost::phoenix::vector2<boost::phoenix::vector2<const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostringstream<char>&>, 0l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::static_cast_, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> > >, 2l> > >, 2l> >*, unsigned char&>&, const boost::phoenix::default_actions&>)>’:
/usr/include/boost/phoenix/object/static_cast.hpp:29: error: declaration of ‘struct boost::phoenix::static_cast_eval::result<boost::phoenix::static_cast_eval(boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>&, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >&, boost::phoenix::vector2<boost::phoenix::vector2<const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostringstream<char>&>, 0l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::static_cast_, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> > >, 2l> > >, 2l> >*, unsigned char&>&, const boost::phoenix::default_actions&>)>’
/usr/include/boost/phoenix/core/detail/preprocessed/call_10.hpp:65: error: no type named ‘type’ in ‘struct boost::result_of<boost::phoenix::static_cast_eval(boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>&, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> >&, boost::phoenix::vector2<boost::phoenix::vector2<const boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::shift_left, boost::proto::argsns_::list2<boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<std::basic_ostringstream<char>&>, 0l> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::tag::static_cast_, boost::proto::argsns_::list2<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::detail::target<unsigned char> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tag::terminal, boost::proto::argsns_::term<boost::phoenix::argument<1> >, 0l> > >, 2l> > >, 2l> >*, unsigned char&>&, const boost::phoenix::default_actions&>)>’
Both compiles here on both GCC & MSVC, if I would have a stab at it I would guess that the offender is:
using boost::phoenix::arg_names::_1;
There's other placeholders with the very same name, some imported to the global scope ( I believe the one boost::bind uses is in the global scope for example ). The last error in particular hints at this, as it would seem a type that is required to be a meta function isn't is used somewhere.