I have the following code
class MyValue
{
std::any value;
MyValue(std::any value)
: value(value)
{
}
public:
using ErrorType = std::string;
using MaybeMy = std::variant<ErrorType, MyValue>;
static MaybeMy safeWrap(std::any const &obj) noexcept
{
if (std::any_cast<int>(&obj) != nullptr)
return MyValue(obj);
else
return ErrorType("There is some alien type");
}
operator std::string() const
{
return std::to_string(std::any_cast<int>(value));
}
MyValue(MyValue &&) = default;
};
int main()
{
auto printer = [](auto &&v) { std::cout << std::string(v) << std::endl; };
MyValue::MaybeMy as[] = {MyValue::safeWrap(10), MyValue::safeWrap("10")};
for (auto &&v : as)
std::visit(printer, v);
}
But I receive errors related with std::variant - MyValue is not constructible.
I cannot understand reasons for this.
Why is MyValue not constructible? And why is there some restriction to execute the code?
Compiler's output:
[build] In file included from /usr/include/c++/9/variant:36,
[build] from /home/created/Documents/Cpp/gstream_test/main.cpp:8:
[build] /usr/include/c++/9/type_traits: In instantiation of ‘struct std::__and_<std::is_copy_constructible<MyValue>, std::is_constructible<MyValue, const MyValue&> >’:
[build] /usr/include/c++/9/any:181:58: required by substitution of ‘template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous>, typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const MyValue&; _Tp = MyValue; _Mgr = std::any::_Manager_external<MyValue>; typename std::enable_if<std::__and_<std::is_copy_constructible<_Tp>, std::is_constructible<_Tp, _ValueType&&> >::value, bool>::type <anonymous> = <missing>; typename std::enable_if<(! std::__is_in_place_type<_Tp>::value), bool>::type <anonymous> = <missing>]’
[build] /usr/include/c++/9/type_traits:883:12: required from ‘struct std::is_constructible<MyValue, const MyValue&>’
[build] /usr/include/c++/9/type_traits:901:12: required from ‘struct std::__is_copy_constructible_impl<MyValue, true>’
[build] /usr/include/c++/9/type_traits:907:12: required from ‘struct std::is_copy_constructible<MyValue>’
[build] /usr/include/c++/9/type_traits:2925:25: required from ‘constexpr const bool std::is_copy_constructible_v<MyValue>’
[build] /usr/include/c++/9/variant:275:5: required from ‘constexpr const bool std::__detail::__variant::_Traits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>::_S_copy_ctor’
[build] /usr/include/c++/9/variant:1220:11: required from ‘class std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>’
[build] /home/created/Documents/Cpp/gstream_test/main.cpp:26:5: required from here
[build] /usr/include/c++/9/type_traits:131:12: error: incomplete type ‘std::is_copy_constructible<MyValue>’ used in nested name specifier
[build] 131 | struct __and_<_B1, _B2>
[build] | ^~~~~~~~~~~~~~~~
[build] /usr/include/c++/9/type_traits: In instantiation of ‘struct std::__and_<std::is_copy_constructible<MyValue>, std::__not_<std::is_constructible<MyValue, const MyValue&> >, std::__not_<std::__is_in_place_type<MyValue> > >’:
[build] /usr/include/c++/9/type_traits:150:27: required from ‘constexpr const bool std::__and_v<std::is_copy_constructible<MyValue>, std::__not_<std::is_constructible<MyValue, const MyValue&> >, std::__not_<std::__is_in_place_type<MyValue> > >’
[build] /usr/include/c++/9/any:192:27: required by substitution of ‘template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const MyValue&; _Tp = MyValue; _Mgr = std::any::_Manager_external<MyValue>; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]’
[build] /usr/include/c++/9/type_traits:883:12: required from ‘struct std::is_constructible<MyValue, const MyValue&>’
[build] /usr/include/c++/9/type_traits:901:12: required from ‘struct std::__is_copy_constructible_impl<MyValue, true>’
[build] /usr/include/c++/9/type_traits:907:12: required from ‘struct std::is_copy_constructible<MyValue>’
[build] /usr/include/c++/9/type_traits:2925:25: required from ‘constexpr const bool std::is_copy_constructible_v<MyValue>’
[build] /usr/include/c++/9/variant:275:5: required from ‘constexpr const bool std::__detail::__variant::_Traits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>::_S_copy_ctor’
[build] /usr/include/c++/9/variant:1220:11: required from ‘class std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>’
[build] /home/created/Documents/Cpp/gstream_test/main.cpp:26:5: required from here
[build] /usr/include/c++/9/type_traits:136:12: error: incomplete type ‘std::is_copy_constructible<MyValue>’ used in nested name specifier
[build] 136 | struct __and_<_B1, _B2, _B3, _Bn...>
[build] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build] /usr/include/c++/9/type_traits: In instantiation of ‘constexpr const bool std::__and_v<std::is_copy_constructible<MyValue>, std::__not_<std::is_constructible<MyValue, const MyValue&> >, std::__not_<std::__is_in_place_type<MyValue> > >’:
[build] /usr/include/c++/9/any:192:27: required by substitution of ‘template<class _ValueType, class _Tp, class _Mgr, typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> > std::any::any(_ValueType&&) [with _ValueType = const MyValue&; _Tp = MyValue; _Mgr = std::any::_Manager_external<MyValue>; typename std::enable_if<__and_v<std::is_copy_constructible<_Tp>, std::__not_<std::is_constructible<_Tp, _ValueType&&> >, std::__not_<std::__is_in_place_type<_Tp> > >, bool>::type <anonymous> = <missing>]’
[build] /usr/include/c++/9/type_traits:883:12: required from ‘struct std::is_constructible<MyValue, const MyValue&>’
[build] /usr/include/c++/9/type_traits:901:12: required from ‘struct std::__is_copy_constructible_impl<MyValue, true>’
[build] /usr/include/c++/9/type_traits:907:12: required from ‘struct std::is_copy_constructible<MyValue>’
[build] /usr/include/c++/9/type_traits:2925:25: required from ‘constexpr const bool std::is_copy_constructible_v<MyValue>’
[build] /usr/include/c++/9/variant:275:5: required from ‘constexpr const bool std::__detail::__variant::_Traits<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>::_S_copy_ctor’
[build] /usr/include/c++/9/variant:1220:11: required from ‘class std::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MyValue>’
[build] /home/created/Documents/Cpp/gstream_test/main.cpp:26:5: required from here
[build] /usr/include/c++/9/type_traits:150:27: error: ‘value’ is not a member of ‘std::__and_<std::is_copy_constructible<MyValue>, std::__not_<std::is_constructible<MyValue, const MyValue&> >, std::__not_<std::__is_in_place_type<MyValue> > >’
[build] 150 | inline constexpr bool __and_v = __and_<_Bn...>::value;
[build] | ^~~~~~~
I'm using gcc 9.3
This is a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90415
It was fixed in gcc 8 and gcc 10+.
The error happens when you have a constructor taking a std::any, which instantiates some type traits really early and breaks stuff, and makes a hard error when you try to move your type (since it also considers the implicit conversion to std::any)
A workaround is to not have a constructor taking std::any, by adding a dummy parameter:
MyValue(int, std::any value)
: value(value)
{
}
// ...
return MyValue(0, obj);
Or using std::experimental::any/std::experimental::fundamentals_v1::any instead
The default accessibility for class members is private. Since your constructor comes before the public: declaration, nobody can construct any objects of this class.
Related
I'm trying to compile the following code (this is a minimal example), but I get a warning I can't figure out:
#include <string>
#include <variant>
#include <vector>
struct Bar {
std::wstring x = L"";
};
Bar Foo() {
std::variant<std::vector<int>, Bar> tmp = Bar();
if (std::holds_alternative<Bar>(tmp)) return std::move(std::get<Bar>(tmp));
return Bar();
}
I'm trying to build this with g++ -std=c++20 -Wall -Wextra -O2 /tmp/test.cc -c
I get the following warning:
In file included from /usr/include/x86_64-linux-gnu/c++/12/bits/c++allocator.h:33,
from /usr/include/c++/12/bits/allocator.h:46,
from /usr/include/c++/12/string:41,
from /tmp/test.cc:1:
In member function ‘void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = int]’,
inlined from ‘constexpr void std::allocator< <template-parameter-1-1> >::deallocate(_Tp*, std::size_t) [with _Tp = int]’ at /usr/include/c++/12/bits/allocator.h:200:35,
inlined from ‘static constexpr void std::allocator_traits<std::allocator<_CharT> >::deallocate(allocator_type&, pointer, size_type) [with _Tp = int]’ at /usr/include/c++/12/bits/alloc_traits.h:496:23,
inlined from ‘constexpr void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = int; _Alloc = std::allocator<int>]’ at /usr/include/c++/12/bits/stl_vector.h:387:19,
inlined from ‘constexpr std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int; _Alloc = std::allocator<int>]’ at /usr/include/c++/12/bits/stl_vector.h:366:15,
inlined from ‘constexpr std::vector<_Tp, _Alloc>::~vector() [with _Tp = int; _Alloc = std::allocator<int>]’ at /usr/include/c++/12/bits/stl_vector.h:733:7,
inlined from ‘constexpr void std::destroy_at(_Tp*) [with _Tp = vector<int>]’ at /usr/include/c++/12/bits/stl_construct.h:88:18,
inlined from ‘constexpr void std::_Destroy(_Tp*) [with _Tp = vector<int>]’ at /usr/include/c++/12/bits/stl_construct.h:149:22,
inlined from ‘std::__detail::__variant::_Variant_storage<false, std::vector<int, std::allocator<int> >, Bar>::_M_reset()::<lambda(auto:11&&)> mutable [with auto:11 = std::vector<int>&]’ at /usr/include/c++/12/variant:472:19,
inlined from ‘constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = __detail::__variant::_Variant_storage<false, vector<int, allocator<int> >, Bar>::_M_reset()::<lambda(auto:11&&)>; _Args = {vector<int, allocator<int> >&}]’ at /usr/include/c++/12/bits/invoke.h:61:36,
inlined from ‘constexpr std::enable_if_t<is_invocable_r_v<_Res, _Callable, _Args ...>, _Res> std::__invoke_r(_Callable&&, _Args&& ...) [with _Res = void; _Callable = __detail::__variant::_Variant_storage<false, vector<int, allocator<int> >, Bar>::_M_reset()::<lambda(auto:11&&)>; _Args = {vector<int, allocator<int> >&}]’ at /usr/include/c++/12/bits/invoke.h:111:28,
inlined from ‘static constexpr decltype(auto) std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<_Result_type (*)(_Visitor, _Variants ...)>, std::integer_sequence<long unsigned int, __indices ...> >::__visit_invoke(_Visitor&&, _Variants ...) [with _Result_type = void; _Visitor = std::__detail::__variant::_Variant_storage<false, std::vector<int, std::allocator<int> >, Bar>::_M_reset()::<lambda(auto:11&&)>&&; _Variants = {std::variant<std::vector<int, std::allocator<int> >, Bar>&}; long unsigned int ...__indices = {0}]’ at /usr/include/c++/12/variant:1035:40,
inlined from ‘constexpr decltype(auto) std::__do_visit(_Visitor&&, _Variants&& ...) [with _Result_type = void; _Visitor = __detail::__variant::_Variant_storage<false, vector<int, allocator<int> >, Bar>::_M_reset()::<lambda(auto:11&&)>; _Variants = {variant<vector<int, allocator<int> >, Bar>&}]’ at /usr/include/c++/12/variant:1783:5,
inlined from ‘constexpr void std::__detail::__variant::_Variant_storage<false, _Types ...>::_M_reset() [with _Types = {std::vector<int, std::allocator<int> >, Bar}]’ at /usr/include/c++/12/variant:470:23,
inlined from ‘constexpr std::__detail::__variant::_Variant_storage<false, _Types ...>::~_Variant_storage() [with _Types = {std::vector<int, std::allocator<int> >, Bar}]’ at /usr/include/c++/12/variant:480:17,
inlined from ‘constexpr std::__detail::__variant::_Copy_ctor_base<false, std::vector<int, std::allocator<int> >, Bar>::~_Copy_ctor_base()’ at /usr/include/c++/12/variant:554:12,
inlined from ‘constexpr std::__detail::__variant::_Move_ctor_base<false, std::vector<int, std::allocator<int> >, Bar>::~_Move_ctor_base()’ at /usr/include/c++/12/variant:591:12,
inlined from ‘constexpr std::__detail::__variant::_Copy_assign_base<false, std::vector<int, std::allocator<int> >, Bar>::~_Copy_assign_base()’ at /usr/include/c++/12/variant:629:12,
inlined from ‘constexpr std::__detail::__variant::_Move_assign_base<false, std::vector<int, std::allocator<int> >, Bar>::~_Move_assign_base()’ at /usr/include/c++/12/variant:681:12,
inlined from ‘constexpr std::__detail::__variant::_Variant_base<std::vector<int, std::allocator<int> >, Bar>::~_Variant_base()’ at /usr/include/c++/12/variant:735:12,
inlined from ‘constexpr std::variant<_Types>::~variant() [with _Types = {std::vector<int, std::allocator<int> >, Bar}]’ at /usr/include/c++/12/variant:1407:28,
inlined from ‘Bar Foo()’ at /tmp/test.cc:13:1:
/usr/include/c++/12/bits/new_allocator.h:158:33: warning: ‘void operator delete(void*, std::size_t)’ called on unallocated object ‘tmp’ [-Wfree-nonheap-object]
158 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
| ^
/tmp/test.cc: In function ‘Bar Foo()’:
/tmp/test.cc:10:39: note: declared here
10 | std::variant<std::vector<int>, Bar> tmp = Bar();
| ^~~
g++ --version says g++ (Debian 12.2.0-10) 12.2.0
I know this code, as is, doesn't make that much sense; but it also shouldn't have this problem: this is a minimal example that exhibits this warning, of a much more complex function.
Strangely, the warning disappears if I do any of the following:
Change Bar::x to be a std::string.
Change tmp to be std::variant<int, Bar> (rather than having a std::vector<int> as the first type).
Remove g++ command-line flag -O2 (i.e., compile with g++ -std=c++20 -Wall -Wextra -O2 /tmp/test.cc -c).
Why would any of these changes make the warning go away!?
If I build this with --std=c++17, the problem remains.
The -Wfree-nonheap-object flag of gcc has a series of false positives bugs, among which bug 99098 is used to record these meta-bugs.
The bug in your example is similar to bug 108088 and has been listed, which issues a false positive warning message since gcc-12.
rand_dat1_sub_handle = node.subscribe<geometry_msgs::Vector3>(
"random/data1", 100,
[](geometry_msgs::Vector3::ConstPtr& data){std::cout<<data->x;});
rand_dat2_sub_handle = node.subscribe<geometry_msgs::Vector3>(
"random/data2", 100,
[](geometry_msgs::Vector3::ConstPtr& data){std::cout<<data->x;});
when I use the above block of code in my class definition script, my build fails giving me the following errors.
In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
from /usr/include/boost/function/detail/function_iterate.hpp:14,
from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
from /usr/include/boost/function.hpp:64,
from /opt/ros/melodic/include/ros/forwards.h:40,
from /opt/ros/melodic/include/ros/common.h:37,
from /opt/ros/melodic/include/ros/ros.h:43,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.h:7,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:2:
/usr/include/boost/function/function_template.hpp: In instantiation of ‘static void boost::detail::function::void_function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with FunctionObj = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&]’:
/usr/include/boost/function/function_template.hpp:925:38: required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:716:7: required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&; typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type = int]’
/usr/include/boost/function/function_template.hpp:1061:16: required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&; typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type = int]’
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:85:83: required from here
/usr/include/boost/function/function_template.hpp:159:11: error: no match for call to ‘(TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>) (const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&)’
BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
^
/usr/include/boost/function/function_template.hpp:159:11: note: candidate: void (*)(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&) {aka void (*)(boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&)} <conversion>
/usr/include/boost/function/function_template.hpp:159:11: note: conversion of argument 2 would be ill-formed:
/usr/include/boost/function/function_template.hpp:159:11: error: binding reference of type ‘geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr& {aka boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&}’ to ‘const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >’ discards qualifiers
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:85:50: note: candidate: TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)> <near match>
[](geometry_msgs::Vector3::ConstPtr& data){std::cout<<data->x<<std::endl;});
^
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:85:50: note: conversion of argument 1 would be ill-formed:
In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
from /usr/include/boost/function/detail/function_iterate.hpp:14,
from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
from /usr/include/boost/function.hpp:64,
from /opt/ros/melodic/include/ros/forwards.h:40,
from /opt/ros/melodic/include/ros/common.h:37,
from /opt/ros/melodic/include/ros/ros.h:43,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.h:7,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:2:
/usr/include/boost/function/function_template.hpp:159:11: error: binding reference of type ‘geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr& {aka boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&}’ to ‘const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >’ discards qualifiers
BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
^
/usr/include/boost/function/function_template.hpp: In instantiation of ‘static void boost::detail::function::void_function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with FunctionObj = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&]’:
/usr/include/boost/function/function_template.hpp:925:38: required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:716:7: required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&; typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type = int]’
/usr/include/boost/function/function_template.hpp:1061:16: required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type) [with Functor = TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>; R = void; T0 = const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&; typename boost::enable_if_c<(! boost::is_integral<Functor>::value), int>::type = int]’
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:89:83: required from here
/usr/include/boost/function/function_template.hpp:159:11: error: no match for call to ‘(TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)>) (const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&)’
/usr/include/boost/function/function_template.hpp:159:11: note: candidate: void (*)(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&) {aka void (*)(boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&)} <conversion>
/usr/include/boost/function/function_template.hpp:159:11: note: conversion of argument 2 would be ill-formed:
/usr/include/boost/function/function_template.hpp:159:11: error: binding reference of type ‘geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr& {aka boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&}’ to ‘const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >’ discards qualifiers
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:89:50: note: candidate: TCPServer::TCPServer(ros::NodeHandle*, QObject*)::<lambda(geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr&)> <near match>
[](geometry_msgs::Vector3::ConstPtr& data){std::cout<<data->x<<std::endl;});
^
/home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:89:50: note: conversion of argument 1 would be ill-formed:
In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
from /usr/include/boost/function/detail/function_iterate.hpp:14,
from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
from /usr/include/boost/function.hpp:64,
from /opt/ros/melodic/include/ros/forwards.h:40,
from /opt/ros/melodic/include/ros/common.h:37,
from /opt/ros/melodic/include/ros/ros.h:43,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.h:7,
from /home/hari/workspace/catkin_ws/src/gui_pkg/src/tcpserver.cpp:2:
/usr/include/boost/function/function_template.hpp:159:11: error: binding reference of type ‘geometry_msgs::Vector3_<std::allocator<void> >::ConstPtr& {aka boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >&}’ to ‘const boost::shared_ptr<const geometry_msgs::Vector3_<std::allocator<void> > >’ discards qualifiers
BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS));
^
gui_pkg/CMakeFiles/TCPSERVER.dir/build.make:62: recipe for target 'gui_pkg/CMakeFiles/TCPSERVER.dir/src/tcpserver.cpp.o' failed
make[2]: *** [gui_pkg/CMakeFiles/TCPSERVER.dir/src/tcpserver.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:1735: recipe for target 'gui_pkg/CMakeFiles/TCPSERVER.dir/all' failed
make[1]: *** [gui_pkg/CMakeFiles/TCPSERVER.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
when i used the regular function callback as shown below, it works fine
rand_dat1_sub_handle = node.subscribe<geometry_msgs::Vector3>(
"random/data1", 100,
&TCPServer::update_data1, this);
How do I use lamdas properly to represent callbacks in subscriber nodes?
I've edited the question showing the new errors after switching from geometry_msgs::Vector3Ptr& to geometry_msgs::Vector3::ConstPtr&.
I'm trying to store a boost::unique_ptr in a std::map. The compiler I'm using is g++ 3.4 (/usr/bin/g++34 -I./boost_1_62_0/ test_boost_unique_ptr.cpp).
#include <iostream>
#include <map>
#include <boost/move/unique_ptr.hpp>
#include <boost/move/make_unique.hpp>
#include <boost/ptr_container/ptr_map.hpp>
using namespace boost::movelib;
typedef std::map<const int, unique_ptr<int> > MGR_T;
typedef MGR_T::const_iterator MGR_ITER_T;
MGR_T mgrPluginCache;
int main()
{
unique_ptr<int> p (new int(10));
std::cout << "p = " << *p << std::endl;
mgrPluginCache.insert(std::make_pair(1, boost::move(p)));
// mgrPluginCache[0] = (boost::move(p));
return 0;
}
This results in compilation error:
In function `int main()':
./boost_1_62_0/boost/move/core.hpp:94: error: `boost::rv<T>::rv(const boost::rv<T>&) [with T = boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> >]' is private
test_boost_unique_ptr.cpp:37: error: within this context
test_boost_unique_ptr.cpp:37: error: initializing argument 2 of `std::pair<_T1, _T2> std::make_pair(_T1, _T2) [with _T1 = int, _T2 = boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > >]'
./boost_1_62_0/boost/move/core.hpp:93: error: `boost::rv<T>::~rv() [with T = boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> >]' is private
test_boost_unique_ptr.cpp:37: error: within this context
test_boost_unique_ptr.cpp: In destructor `std::pair<int, boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > > >::~pair()':
./boost_1_62_0/boost/move/core.hpp:93: error: `boost::rv<T>::~rv() [with T = boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> >]' is private
test_boost_unique_ptr.cpp:37: error: within this context
test_boost_unique_ptr.cpp: In copy constructor `std::pair<int, boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > > >::pair(const std::pair<int, boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > > >&)':
./boost_1_62_0/boost/move/core.hpp:94: error: `boost::rv<T>::rv(const boost::rv<T>&) [with T = boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> >]' is private
test_boost_unique_ptr.cpp:37: error: within this context
./boost_1_62_0/boost/move/core.hpp:93: error: `boost::rv<T>::~rv() [with T = boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> >]' is private
test_boost_unique_ptr.cpp:37: error: within this context
./boost_1_62_0/boost/ptr_container/ptr_map_adapter.hpp: In member function `void boost::ptr_map_adapter<T, VoidPtrMap, CloneAllocator, Ordered>::insert(const Range&) [with Range = std::pair<int, boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > > >, T = boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> >, VoidPtrMap = std::map<const int, void*, std::less<const int>, std::allocator<std::pair<const int, void*> > >, CloneAllocator = boost::heap_clone_allocator, bool Ordered = true]':
test_boost_unique_ptr.cpp:37: instantiated from here
./boost_1_62_0/boost/ptr_container/ptr_map_adapter.hpp:518: error: no matching function for call to `begin(const std::pair<int, boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > > >&)'
./boost_1_62_0/boost/ptr_container/ptr_map_adapter.hpp:518: error: no matching function for call to `end(const std::pair<int, boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > > >&)'
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h: In constructor `std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _T1 = int, _T2 = boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > >]':
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h:144: instantiated from `std::pair<_T1, _T2> std::make_pair(_T1, _T2) [with _T1 = int, _T2 = boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > >]'
test_boost_unique_ptr.cpp:37: instantiated from here
./boost_1_62_0/boost/move/core.hpp:94: error: `boost::rv<T>::rv(const boost::rv<T>&) [with T = boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> >]' is private
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h:85: error: within this context
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h:144: instantiated from `std::pair<_T1, _T2> std::make_pair(_T1, _T2) [with _T1 = int, _T2 = boost::rv<boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> > >]'
test_boost_unique_ptr.cpp:37: instantiated from here
./boost_1_62_0/boost/move/core.hpp:93: error: `boost::rv<T>::~rv() [with T = boost::movelib::unique_ptr<int, boost::movelib::default_delete<int> >]' is private
/usr/lib/gcc/x86_64-redhat-linux/3.4.6/../../../../include/c++/3.4.6/bits/stl_pair.h:85: error: within this context
Is there a way to store the boost::unique_ptr in std::map? Is it allowed in earlier versions? Can we do this any other way? I cannot change the compiler, the code I'm working on is very old and has not been modified in long time.
value_type of std::map requires copy constructor for insert. boost::unique_ptr have a private copy constructor (which could have been deleted I suppose)
You can simply use emplace (you'll also need to std::move or boost::move it):
mgrPluginCache.emplace(1, boost::move(foo));
But... if you have std::map::emplace then your compiler supports c++11, then you may consider using std::unique_ptr instead of boost.
P.S.
g++ 3.4.6 is +10 years old and is likely to break something in recent boost versions. Is there any specific reason to use an outdated compiler?
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 =
I'm compiling a large program with gcc-4.4.7 --std=c++0x and several libraries from boost-1.53. The compiler is complaining about a bunch of errors in the boost libraries (below), but not about my code. Is this a bug in boost libraries? How would I go about figuring out what's wrong? Any suggestions appreciated!
/usr/bin/g++ -O0 -ggdb -fno-inline --std=c++0x -pedantic -Wall -fno-strict-aliasing -Wno-non-template-friend -Wno-long-long -Wno-deprecated -m64 -I /home/user1/pkg/boost-64bit -I/data/home_local/user2/dev/bbb-onForge-trunk/src -I/data/home_local/user2/dev/bbb-onForge-trunk/src/util/containers -I/data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc -I /usr/include -c -o /data/home_local/user2/dev/bbb-onForge-trunk/obj/Linux/dbg/bbb/trainOne.o /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp
In file included from /home/user1/pkg/boost-64bit/boost/filesystem/path_traits.hpp:23,
from /home/user1/pkg/boost-64bit/boost/filesystem/path.hpp:25,
from /home/user1/pkg/boost-64bit/boost/filesystem.hpp:16,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/parameter.hpp:31,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/system/error_code.hpp: In function 'boost::system::error_code& boost::throws()':
/home/user1/pkg/boost-64bit/boost/system/error_code.hpp:410: error: reference to 'detail' is ambiguous
/home/user1/pkg/boost-64bit/boost/type_traits/is_reference.hpp:25: error: candidates are: namespace boost::detail { }
/home/user1/pkg/boost-64bit/boost/tuple/detail/tuple_basic.hpp:51: error: namespace boost::tuples::detail { }
In file included from /home/user1/pkg/boost-64bit/boost/tokenizer.hpp:20,
from /home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:15,
from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:13,
from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/gregorian.hpp:34,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:12,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/token_iterator.hpp: At global scope:
/home/user1/pkg/boost-64bit/boost/token_iterator.hpp:34: error: reference to 'detail' is ambiguous
/home/user1/pkg/boost-64bit/boost/type_traits/is_reference.hpp:25: error: candidates are: namespace boost::detail { }
/home/user1/pkg/boost-64bit/boost/tuple/detail/tuple_basic.hpp:51: error: namespace boost::tuples::detail { }
/home/user1/pkg/boost-64bit/boost/token_iterator.hpp:39: error: template argument 3 is invalid
In file included from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:13,
from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/gregorian.hpp:34,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:12,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp: In function 'date_type boost::date_time::parse_date(const std::string&, int)':
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:133: error: no match for 'operator!=' in 'beg != tok.boost::tokenizer<TokenizerFunc, Iterator, Type>::end [with TokenizerFunc = boost::char_separator<char, std::char_traits<char> >, Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Type = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]()'
/home/user1/pkg/boost-64bit/boost/tuple/tuple_comparison.hpp:41: note: candidates are: bool boost::tuples::operator!=(const boost::tuples::null_type&, const boost::tuples::null_type&)
/home/user1/pkg/boost-64bit/boost/blank.hpp:73: note: bool boost::operator!=(const boost::blank&, const boost::blank&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:764: note: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:752: note: bool boost::operator!=(const boost::function_base&, boost::detail::function::useless_clear_type*)
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:134: error: no match for 'operator++' in '++beg'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:138: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:143: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:148: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp: In function 'date_type boost::date_time::parse_undelimited_date(const std::string&)':
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:178: error: no match for 'operator!=' in 'ti != tok.boost::tokenizer<TokenizerFunc, Iterator, Type>::end [with TokenizerFunc = boost::offset_separator, Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Type = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]()'
/home/user1/pkg/boost-64bit/boost/tuple/tuple_comparison.hpp:41: note: candidates are: bool boost::tuples::operator!=(const boost::tuples::null_type&, const boost::tuples::null_type&)
/home/user1/pkg/boost-64bit/boost/blank.hpp:73: note: bool boost::operator!=(const boost::blank&, const boost::blank&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:764: note: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:752: note: bool boost::operator!=(const boost::function_base&, boost::detail::function::useless_clear_type*)
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:178: error: no match for 'operator++' in '++ti'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:179: error: no match for 'operator*' in '*ti'
In file included from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:19,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp: In function 'time_duration boost::date_time::parse_undelimited_time_duration(const std::string&)':
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:228: error: no match for 'operator!=' in 'ti != tok.boost::tokenizer<TokenizerFunc, Iterator, Type>::end [with TokenizerFunc = boost::offset_separator, Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Type = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]()'
/home/user1/pkg/boost-64bit/boost/tuple/tuple_comparison.hpp:41: note: candidates are: bool boost::tuples::operator!=(const boost::tuples::null_type&, const boost::tuples::null_type&)
/home/user1/pkg/boost-64bit/boost/blank.hpp:73: note: bool boost::operator!=(const boost::blank&, const boost::blank&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:764: note: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:752: note: bool boost::operator!=(const boost::function_base&, boost::detail::function::useless_clear_type*)
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:228: error: no match for 'operator++' in '++ti'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:232: error: no match for 'operator*' in '*ti'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:237: error: no match for 'operator*' in '*ti'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:242: error: no match for 'operator*' in '*ti'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:247: error: base operand of '->' has non-pointer type 'boost::date_time::parse_undelimited_time_duration(const std::string&)::tokenizer_iterator'
In file included from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:13,
from /home/user1/pkg/boost-64bit/boost/date_time/gregorian/gregorian.hpp:34,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:12,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp: In function 'boost::date_time::period<date_type, typename date_type::duration_type> boost::date_time::from_simple_string_type(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with date_type = boost::gregorian::date, charT = char]':
/home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:79: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:299: error: no match for 'operator*' in '*tok_it'
/home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:79: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:305: error: no match for 'operator++' in '++tok_it'
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp: In function 'boost::date_time::period<date_type, typename date_type::duration_type> boost::date_time::from_simple_string_type(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with date_type = boost::gregorian::date, charT = wchar_t]':
/home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:84: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:299: error: no match for 'operator*' in '*tok_it'
/home/user1/pkg/boost-64bit/boost/date_time/gregorian/parsers.hpp:84: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/date_parsing.hpp:305: error: no match for 'operator++' in '++tok_it'
In file included from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_formatters.hpp:19,
from /home/user1/pkg/boost-64bit/boost/date_time/posix_time/posix_time.hpp:24,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/util/misc/ResourceUsage.hpp:4,
from /data/home_local/user2/dev/bbb-onForge-trunk/src/bbb/trainOne.cpp:6:
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp: In function 'time_duration boost::date_time::str_from_delimited_time_duration(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with time_duration = boost::posix_time::time_duration, char_type = char]':
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:146: instantiated from 'time_duration boost::date_time::parse_delimited_time_duration(const std::string&) [with time_duration = boost::posix_time::time_duration]'
/home/user1/pkg/boost-64bit/boost/date_time/posix_time/time_parsers.hpp:27: instantiated from here
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:68: error: no match for 'operator!=' in 'beg != boost::tokenizer<TokenizerFunc, Iterator, Type>::end() const [with TokenizerFunc = boost::char_separator<char, std::char_traits<char> >, Iterator = __gnu_cxx::__normal_iterator<const char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, Type = std::basic_string<char, std::char_traits<char>, std::allocator<char> >]()'
/home/user1/pkg/boost-64bit/boost/tuple/tuple_comparison.hpp:41: note: candidates are: bool boost::tuples::operator!=(const boost::tuples::null_type&, const boost::tuples::null_type&)
/home/user1/pkg/boost-64bit/boost/blank.hpp:73: note: bool boost::operator!=(const boost::blank&, const boost::blank&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:764: note: bool boost::operator!=(boost::detail::function::useless_clear_type*, const boost::function_base&)
/home/user1/pkg/boost-64bit/boost/function/function_base.hpp:752: note: bool boost::operator!=(const boost::function_base&, boost::detail::function::useless_clear_type*)
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:68: error: no match for 'operator++' in '++beg'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:71: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:75: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:79: error: no match for 'operator*' in '*beg'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:83: error: base operand of '->' has non-pointer type 'boost::date_time::str_from_delimited_time_duration(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with time_duration = boost::posix_time::time_duration, char_type = char]::tokenizer_iterator'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:104: error: base operand of '->' has non-pointer type 'boost::date_time::str_from_delimited_time_duration(const std::basic_string<charT, std::char_traits<_CharT>, std::allocator<_T2> >&) [with time_duration = boost::posix_time::time_duration, char_type = char]::tokenizer_iterator'
/home/user1/pkg/boost-64bit/boost/date_time/time_parsing.hpp:107: error: no match for 'operator*' in '*beg'
Are you doing the below in your code ?
using namespace boost;
using namespace boost::tuples;
If so, Compiler is not able to judge which detail to use from the below files.
/home/user1/pkg/boost-64bit/boost/type_traits/is_reference.hpp
/home/user1/pkg/boost-64bit/boost/tuple/detail/tuple_basic.hpp