#include <iostream>
#include <boost/assign.hpp>
#include <boost/assign/list_of.hpp>
#include <tuple>
using namespace std;
using namespace boost::assign;
int main() {
class NodeInfo
{
public:
NodeInfo (int Parent, int childLeft, int childRight) :
m_parent (Parent), m_childLeft(childLeft), m_childRight(childRight)
{
}
private:
int m_parent;
int m_childLeft;
int m_childRight;
};
typedef std::vector<NodeInfo> MyData1;
MyData1 expData = list_of(NodeInfo(1,2,3)) (NodeInfo(3,4,5));
typedef std::tuple<int , std::vector<NodeInfo>> MyData2;
MyData2 expData21 = std::make_tuple(10 , expData);
MyData2 expData22 = std::make_tuple(10 , list_of(NodeInfo(1,2,3)) (NodeInfo(3,4,5)) );
// I would have really liked the following:
// error:
//MyData2 expData22 = std::make_tuple(10 ,
//list_of(NodeInfo(1,2,3)) (NodeInfo(3,4,5)) );
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Ym9vc3QvYXNzaWduLmhwcD4KI2luY2x1ZGUgPGJvb3N0L2Fzc2lnbi9saXN0X29mLmhwcD4KI2luY2x1ZGUgPHR1cGxlPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp1c2luZyBuYW1lc3BhY2UgYm9vc3Q6OmFzc2lnbjsKCmludCBtYWluKCkgewoKY2xhc3MgTm9kZUluZm8KewogICAgcHVibGljOgogICAgICAgIE5vZGVJbmZvIChpbnQgUGFyZW50LCBpbnQgY2hpbGRMZWZ0LCBpbnQgY2hpbGRSaWdodCkgOgogICAgICAgICAgICBtX3BhcmVudCAoUGFyZW50KSwgbV9jaGlsZExlZnQoY2hpbGRMZWZ0KSwgbV9jaGlsZFJpZ2h0KGNoaWxkUmlnaHQpCiAgICAgICAgICAgIHsgICAKCiAgICAgICAgICAgIH0KICAgICAgICBwcml2YXRlOgogICAgICAgICAgICBpbnQgbV9wYXJlbnQ7CiAgICAgICAgICAgIGludCBtX2NoaWxkTGVmdDsKICAgICAgICAgICAgaW50IG1fY2hpbGRSaWdodDsKfTsKdHlwZWRlZiBzdGQ6OnZlY3RvcjxOb2RlSW5mbz4gTXlEYXRhMTsKTXlEYXRhMSBleHBEYXRhID0gIGxpc3Rfb2YoTm9kZUluZm8oMSwyLDMpKSAoTm9kZUluZm8oMyw0LDUpKTsKCnR5cGVkZWYgc3RkOjp0dXBsZTxpbnQgLCBzdGQ6OnZlY3RvcjxOb2RlSW5mbz4+IE15RGF0YTI7Ck15RGF0YTIgZXhwRGF0YTIxID0gIHN0ZDo6bWFrZV90dXBsZSgxMCAsIGV4cERhdGEpOwoKTXlEYXRhMiBleHBEYXRhMjIgPSAgc3RkOjptYWtlX3R1cGxlKDEwICwgbGlzdF9vZihOb2RlSW5mbygxLDIsMykpIChOb2RlSW5mbygzLDQsNSkpICk7CiAvLyBJIHdvdWxkIGhhdmUgcmVhbGx5IGxpa2VkIHRoZSBmb2xsb3dpbmc6CiAvLyBlcnJvcjoKIC8vTXlEYXRhMiBleHBEYXRhMjIgPSAgc3RkOjptYWtlX3R1cGxlKDEwICwKIC8vbGlzdF9vZihOb2RlSW5mbygxLDIsMykpIChOb2RlSW5mbygzLDQsNSkpICk7CgoKcmV0dXJuIDA7Cn0=
In file included from /usr/include/c++/4.9/bits/stl_map.h:63:0,
from /usr/include/c++/4.9/map:61,
from /usr/include/boost/assign/std/map.hpp:21,
from /usr/include/boost/assign/std.hpp:25,
from /usr/include/boost/assign.hpp:19,
from prog.cpp:2:
/usr/include/c++/4.9/tuple: In instantiation of 'constexpr std::_Head_base<_Idx, _Head, false>::_Head_base(_UHead&&) [with _UHead = boost::assign_detail::generic_list<main()::NodeInfo>; unsigned int _Idx = 1u; _Head = std::vector<main()::NodeInfo>]':
/usr/include/c++/4.9/tuple:285:57: recursively required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _UHead, _UTails ...>&&) [with _UHead = boost::assign_detail::generic_list<main()::NodeInfo>; _UTails = {}; unsigned int _Idx = 1u; _Head = std::vector<main()::NodeInfo>; _Tail = {}]'
/usr/include/c++/4.9/tuple:285:57: required from 'constexpr std::_Tuple_impl<_Idx, _Head, _Tail ...>::_Tuple_impl(std::_Tuple_impl<_Idx, _UHead, _UTails ...>&&) [with _UHead = int; _UTails = {boost::assign_detail::generic_list<main()::NodeInfo>}; unsigned int _Idx = 0u; _Head = int; _Tail = {std::vector<main()::NodeInfo, std::allocator<main()::NodeInfo> >}]'
/usr/include/c++/4.9/tuple:556:60: required from 'constexpr std::tuple<_T1, _T2>::tuple(std::tuple<_U1, _U2>&&) [with _U1 = int; _U2 = boost::assign_detail::generic_list<main()::NodeInfo>; <template-parameter-2-3> = void; _T1 = int; _T2 = std::vector<main()::NodeInfo>]'
prog.cpp:29:86: required from here
/usr/include/c++/4.9/tuple:142:42: error: call of overloaded 'vector(boost::assign_detail::generic_list<main()::NodeInfo>)' is ambiguous
: _M_head_impl(std::forward<_UHead>(__h)) { }
^
/usr/include/c++/4.9/tuple:142:42: note: candidates are:
In file included from /usr/include/c++/4.9/vector:64:0,
from /usr/include/boost/assign/std/vector.hpp:20,
from /usr/include/boost/assign/std.hpp:18,
from /usr/include/boost/assign.hpp:19,
from prog.cpp:2:
/usr/include/c++/4.9/bits/stl_vector.h:373:7: note: std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = main()::NodeInfo; _Alloc = std::allocator<main()::NodeInfo>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<main()::NodeInfo>]
vector(initializer_list<value_type> __l,
^
/usr/include/c++/4.9/bits/stl_vector.h:335:7: note: std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = main()::NodeInfo; _Alloc = std::allocator<main()::NodeInfo>]
vector(vector&& __x) noexcept
^
/usr/include/c++/4.9/bits/stl_vector.h:318:7: note: std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = main()::NodeInfo; _Alloc = std::allocator<main()::NodeInfo>]
vector(const vector& __x)
^
/usr/include/c++/4.9/bits/stl_vector.h:277:7: note: std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = main()::NodeInfo; _Alloc = std::allocator<main()::NodeInfo>; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<main()::NodeInfo>]
vector(size_type __n, const allocator_type& __a = allocator_type())
^
/usr/include/c++/4.9/bits/stl_vector.h:264:7: note: std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = main()::NodeInfo; _Alloc = std::allocator<main()::NodeInfo>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<main()::NodeInfo>]
vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
^