Re: [Cppcms-users] error in json.h
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2013-05-22 18:42:09
|
The point is that ap has a type pair<const string,value>. object is a map of string to json value
that is why it is not working
------------------------------
On Wed, May 22, 2013 1:03 PM IDT Marcel Hellwig wrote:
>Hi Artyom,
>
>in your cppcms/json.h (which is really nice) is an error.
>
>If you try this
>
> for(auto& ap : v.object())
> createLogger(ap);
>where v is a json::value and create logger is this
>
> void createLogger(const cppcms::json::value &obj);
>you will receive this error message
> In file included from
> /home/marcel/projects/logre/src/configloader.cpp:21:0:
> /usr/local/include/cppcms/json.h: In instantiation of ‘static void
> cppcms::json::traits<std::pair<_T1, _T2> >::set(cppcms::json::value&,
> const std::pair<_T1, _T2>&) [with T1 = const cppcms::string_key; T2 =
> cppcms::json::value]’:
> /usr/local/include/cppcms/json.h:245:26: required from ‘void
> cppcms::json::value::set_value(const T&) [with T = std::pair<const
> cppcms::string_key, cppcms::json::value>]’
> /usr/local/include/cppcms/json.h:314:4: required from
> ‘cppcms::json::value::value(const T&) [with T = std::pair<const
> cppcms::string_key, cppcms::json::value>]’
> /home/marcel/projects/logre/src/configloader.cpp:51:24: required from here
> /usr/local/include/cppcms/json.h:601:4: error: no matching function
> for call to ‘cppcms::json::value::set_value(const char [6], const
> cppcms::string_key&)’
> v.set_value("first",in.first);
0> ^
> /usr/local/include/cppcms/json.h:601:4: note: candidate is:
> In file included from
> /home/marcel/projects/logre/src/configloader.cpp:21:0:
> /usr/local/include/cppcms/json.h:243:8: note: template<class T> void
> cppcms::json::value::set_value(const T&)
> void set_value(T const &v)
> ^
> /usr/local/include/cppcms/json.h:243:8: note: template argument
> deduction/substitution failed:
> In file included from
> /home/marcel/projects/logre/src/configloader.cpp:21:0:
> /usr/local/include/cppcms/json.h:601:4: note: candidate expects 1
> argument, 2 provided
> v.set_value("first",in.first);
> ^
> /usr/local/include/cppcms/json.h:602:4: error: no matching function
> for call to ‘cppcms::json::value::set_value(const char [7], const
> cppcms::json::value&)’
> v.set_value("second",in.second);
> ^
> /usr/local/include/cppcms/json.h:602:4: note: candidate is:
> In file included from
> /home/marcel/projects/logre/src/configloader.cpp:21:0:
> /usr/local/include/cppcms/json.h:243:8: note: template<class T> void
> cppcms::json::value::set_value(const T&)
> void set_value(T const &v)
> ^
> /usr/local/include/cppcms/json.h:243:8: note: template argument
> deduction/substitution failed:
> In file included from
> /home/marcel/projects/logre/src/configloader.cpp:21:0:
> /usr/local/include/cppcms/json.h:602:4: note: candidate expects 1
> argument, 2 provided
> v.set_value("second",in.second);
>and yeah, there is no set_value function which takes two arguments. I
>think you missed something ;)
>Error occurred in the latest-svn-version. Hope you will fix it or say
>what I am missing.
>
>Regards
>Marcel Hellwig
>
>
>
|