|
-
June 4th, 2018, 09:13 AM
#1
Compilation issue with the boost::assign:list_of and map_list_of
Hello,
I have added boost::assign:list_of and map_list_of in the following way in my project. The same compiles when I try to do the local testing with the folowing function:
Code:
#include <boost/assign.hpp>
using namespace std;
using boost::assign::list_of;
using boost::assign::map_list_of;
typedef map<string,int> value_type;
typedef map<string,value_type> map_type;
map_type someMap =
boost::assign::list_of<map_type::value_type>
("ex",
boost::assign::map_list_of
("ab", 1)
("xy", 2)
)
;
int main()
{
}
But when I add as part of the Project like
In .h file:
Code:
typedef map<string, int> MediaType2GBR;
typedef map<string, MediaType2GBR> Subcat2MediaType2GBR;
class CPCRF : public CBaseClass
{
public:
static std::map<std::string, PcrfMediaType_Value> m_mMapStringToPcrfMediaType;
};
And in the .cpp file:
Code:
Subcat2MediaType2GBR CPCRF::m_mServiceType2MediaType2GBR =
boost::assign::list_of<MediaType2GBR>
(
"Gold",
boost::assign::map_list_of
("Audio", 10)
("Video", 20)
);
I am getting the compilation error:
/root/SVN_ROOT/../SVN_THIRDPARTY/boost/ECX_Boost_1_63_0_tag1/x86/include/boost/preprocessor/iteration/detail/local.hpp: In member function ‘boost::assign_detail::generic_list<T>& boost::assign_detail::generic_list<T>: perator()(const U&, const U0&) [with U = char [5], U0 = boost::assign_detail::generic_list<std: air<const char*, int> >, T = std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std: air<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > >]’:
/root/SVN_ROOT/../SVN_THIRDPARTY/boost/ECX_Boost_1_63_0_tag1/x86/include/boost/preprocessor/iteration/detail/local.hpp:37: instantiated from ‘boost::assign_detail::generic_list<T> boost::assign::list_of(const U&, const U0&) [with T = std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std: air<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int> > >, U = char [5], U0 = boost::assign_detail::generic_list<std: air<const char*, int> >]’
ransrc/CPCRF.cpp:95: instantiated from here
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|