I'm have the following elements:
#define TEMPLATE_PARAM boost::variant<int, const std::string&, const std::vector<std::string>&, const std::vector<int>&, const ITemplateLoop*, const std::vector<ITemplateLoop*>&>
class PostParam
{
...
const std::string &getParam() const;
};
class ParamContainer
{
std::map<std::string, TEMPLATE_PARAM> map_;
template <typename T>
void insert(std::string key, const T & value)
{
map_[key] = value;
}
public:
template<typename ... Args>
void add(std::map<std::string, std::shared_ptr<PostParam>>& param, Args ... args)
{
for (const auto & key : param)
insert(key.first, key.second->getParam());
if (sizeof ...(Args) > 0)
add(args...);
}
I am getting a lot of compilation error and I don't know what to paste here
/usr/local/include/boost/detail/reference_content.hpp: In member function 'void boost::detail::variant::move_storage::internal_visit(T&, int) const [with T = boost::de tail::reference_content<const std::basic_string<char>&>]':
/usr/local/include/boost/variant/detail/visitation_impl.hpp:130:9: instantiated from 'typename Visitor::result_type boost::detail::variant::visitation_impl_invoke_impl(int, Visitor&, VoidPtrCV, T*, mpl_::true_) [with Visitor = boost::detail::variant::move_storage, VoidPtrCV = void*, T = boost::detail::reference_content<const std::basic_string<char>&>, typename Visitor::result_type = void, mpl_::true_ = mpl_::bool_<true>]'
/usr/local/include/boost/variant/detail/visitation_impl.hpp:173:9: instantiated from 'typename Visitor::result_type boost::detail::variant::visitation_impl_invoke(int, Visitor&, VoidPtrCV, T*, NoBackupFlag, int) [with Visitor=boost::detail::variant::move_storage, VoidPtrCV = void*, T = boost::detail::reference_content<const std::basic_string<char>&>, NoBackupFlag = boost::variant<int, const std::basic_string<char>&, const std::vector<std::basic_string<char> >&, const std::vector<int>&, const TemplateEngine::ITemplateLoop*, const std::vector<TemplateEngine::ITemplateLoop*>&, const PostParam&>::has_fallback_type_, typename Visitor::result_type = void]'
/usr/local/include/boost/variant/detail/visitation_impl.hpp:260:1: instantiated from 'typename Visitor::result_type boost::detail::variant::visitation_impl(int, int, Visitor&, VoidPtrCV, mpl_::false_, NoBackupFlag, Which*, step0*) [with Which = mpl_::int_<0>, step0 = boost::detail::variant::visitation_impl_step<boost::mpl::l_iter< boost::mpl::l_item<mpl_::long_<7l>, int, boost::mpl::l_item<mpl_::long_<6l>, boost::detail::reference_content<const std::basic_string<char>&>, boost::mpl::l_item<mpl_: :long_<5l>, boost::detail::reference_content<const std::vector<std::basic_string<char> >&>, boost::mpl::l_item<mpl_::long_<4l>, boost::detail::reference_content<const std::vector<int>&>, boost::mpl::l_item<mpl_::long_<3l>, const TemplateEngine::ITemplateLoop*, boost::mpl::l_item<mpl_::long_<2l>, boost::detail::reference_content<const std::vector<TemplateEngine::ITemplateLoop*>&>, boost::mpl::l_item<mpl_::long_<1l>, boost::detail::reference_content<const PostParam&>, boost::mpl::l_end> > > > > > > >, boost::mpl::l_iter<boost::mpl::l_end> >, Visitor = boost::detail::variant::move_storage, VoidPtrCV = void*, NoBackupFlag = boost::variant<int, const std::basic_string<char>&, const std::vector<std::basic_string<char> >&, const std::vector<int>&, const TemplateEngine::ITemplateLoop*, const std::vector<TemplateEngine::ITemplateLoop*>&, const PostParam&>::has_fallback_type_, typename Visitor::result_type = void, mpl_::false_ = mpl_::bool_<false>]'
I think it's the parameter that I get using key.second->getParam() but I'm unable to find a solution
Edit
I have changed the #define to the typedef So the error message
/home/django/cloaked-ninja/includes/TemplateEngine.hpp:67:7: instantiated from 'void TemplateEngine::ParamContainer::insert(std::string, const T&) [with T = std::basic_string<char>, std::string = std::basic_string<char>]'
/home/django/cloaked-ninja/includes/TemplateEngine.hpp:94:2: instantiated from 'void TemplateEngine::ParamContainer::add(std::map<std::basic_string<char>, std::shared_ptr<PostParam> >&, Args ...) [with Args = {}]'
/home/django/cloaked-ninja/src/Controller/ControllerPost.cpp:22:14: instantiated from here
/usr/local/include/boost/detail/reference_content.hpp:62:24: error: 'boost::detail::reference_content<RefT>& boost::detail::reference_content<RefT>::operator=(const boost::detail::reference_content<RefT>&) [with RefT = const std::basic_string<char>&, boost::detail::reference_content<RefT> = boost::detail::reference_content<const std::basic_string<char>&>]' is private
/usr/local/include/boost/variant/variant.hpp:583:9: error: within this context
/usr/local/include/boost/detail/reference_content.hpp: In member function 'void boost::detail::variant::move_storage::internal_visit(T&, int) const [with T = boost::de tail::reference_content<const std::vector<std::basic_string<char> >&>]':
/usr/local/include/boost/variant/detail/visitation_impl.hpp:130:9: instantiated from 'typename Visitor::result_type boost::detail::variant::visitation_impl_invoke_impl(int, Visitor&, VoidPtrCV, T*, mpl_::true_) [with Visitor = boost::detail::variant::move_storage, VoidPtrCV = void*, T = boost::detail::reference_content<const std::vector<std::basic_string<char> >&>, typename Visitor::result_type = void, mpl_::true_ = mpl_::bool_<true>]'
/usr/local/include/boost/detail/reference_content.hpp: In member function 'void boost::detail::variant::move_storage::internal_visit(T&, int) const [with T = boost::detail::reference_content<const std::vector<std::basic_string<char> >&>]':
/usr/local/include/boost/variant/detail/visitation_impl.hpp:130:9: instantiated from 'typename Visitor::result_type boost::detail::variant::visitation_impl_invoke_impl(int, Visitor&, VoidPtrCV, T*, mpl_::true_) [with Visitor = boost::detail::variant::move_storage, VoidPtrCV = void*, T = boost::detail::reference_content<const
std::vector<std::basic_string<char> >&>, typename Visitor::result_type = void, mpl_::true_ = mpl_::bool_<true>]'
/usr/local/include/boost/variant/detail/visitation_impl.hpp:173:9: instantiated from 'typename Visitor::result_type boost::detail::variant::visitation_impl_invoke(int, Visitor&, VoidPtrCV, T*, NoBackupFlag, int) [with Visitor = boost::detail::variant::move_storage, VoidPtrCV = void*, T = boost::detail::reference_content<const std::vector<std::basic_string<char> >&>, NoBackupFlag = boost::variant<int, const std::basic_string<char>&, const std::vector<std::basic_string<char> >&, const std::vector<int>&, const TemplateEngine::ITemplateLoop*, const std::vector<TemplateEngine::ITemplateLoop*>&>::has_fallback_type_, typename Visitor::result_type = void]'
/usr/local/include/boost/variant/detail/visitation_impl.hpp:260:1: instantiated from 'typename Visitor::result_type boost::detail::variant::visitation_impl(int, int, Visitor&, VoidPtrCV, mpl_::false_, NoBackupFlag, Which*, step0*) [with Which = mpl_::int_<0>, step0 = boost::detail::variant::visitation_impl_step<boost::mpl::l_iter<boost::mpl::l_item<mpl_::long_<6l>, int, boost::mpl::l_item<mpl_::long_<5l>, boost::detail::reference_content<const std::basic_string<char>&>, boost::mpl::l_item<mpl_::long_<4l>, boost::detail::reference_content<const std::vector<std::basic_string<char> >&>, boost::mpl::l_item<mpl_::long_<3l>, boost::detail::reference_content<const std::vector<int>&>, boost::mpl::l_item<mpl_::long_<2l>, const TemplateEngine::ITemplateLoop*, boost::mpl::l_item<mpl_::long_<1l>, boost::detail::reference_content<const std::vector<TemplateEngine::ITemplateLoop*>&>, boost::mpl::l_end> > > > > > >, boost::mpl::l_iter<boost::mpl::l_end> >, Visitor = boost::detail::variant::move_storage, VoidPtrCV = void*, NoBackupFlag = boost::variant<int, const std::basic_string<char>&, const std::vector<std::basic_string<char> >&, const std::vector<int>&, const TemplateEngine::ITemplateLoop*, const std::vector<TemplateEngine::ITemplateLoop*>&>::has_fallback_type_, typename Visitor::result_type = void, mpl_::false_ = mpl_::bool_<false>]'
Edit2
I have just changed the #define to the following typedef and it's now working:
typedef boost::variant<int, const std::string*, const std::vector<std::string>*, const std::vector<int>*, const ITemplateLoop*, const std::vector<ITemplateLoop*>*> TEMPLATE_PARAM;