Describe the bug
Can not compile in c++ 11 standard.
The sample program in readme cannot be compiled normally under c++ 11
To Reproduce
// Script returns a single element.
auto num = redis.eval<long long>("return 1", {}, {});
// Script returns an array of elements.
std::vector<long long> nums;
redis.eval("return {ARGV[1], ARGV[2]}", {}, {"1", "2"}, std::back_inserter(nums));
// mset with TTL
auto mset_with_ttl_script = R"(
local len = #KEYS
if (len == 0 or len + 1 ~= #ARGV) then return 0 end
local ttl = tonumber(ARGV[len + 1])
if (not ttl or ttl <= 0) then return 0 end
for i = 1, len do redis.call("SET", KEYS[i], ARGV[i], "EX", ttl) end
return 1
)";
Expected behavior
A clear and concise description of what you expected to happen.
Additional context
include/sw/redis++/command_args.h:157:15: error: no match for 'operator<<' (operand types are 'sw::redis::CmdArgs' and 'sw::redis::Optional<std::__cxx11::basic_string >')
this << first;
include/sw/redis++/command_args.h:112:17: note: candidate: 'sw::redis::CmdArgs& sw::redis::CmdArgs::operator<<(const sw::redis::StringView&)'
inline CmdArgs& CmdArgs::operator<<(const StringView &arg) {
^~~~~~~
include/sw/redis++/command_args.h:112:17: note: no known conversion for argument 1 from 'sw::redis::Optional<std::__cxx11::basic_string<char> >' to 'const sw::redis::StringView&'
include/sw/redis++/command_args.h:127:17: note: candidate: 'template<class T, typename std::enable_if<std::is_arithmetic<typename std::decay<_Tp>::type>::value, int>::type <anonymous> > sw::redis::CmdArgs& sw::redis::CmdArgs::operator<<(T&&)'
inline CmdArgs& CmdArgs::operator<<(T &&arg) {
^~~~~~~
include/sw/redis++/command_args.h:127:17: note: template argument deduction/substitution failed:
include/sw/redis++/command_args.h:43:54: error: no type named 'type' in 'struct std::enable_if<false, int>'
Hi, Thank you for your help,
Describe the bug Can not compile in c++ 11 standard. The sample program in readme cannot be compiled normally under c++ 11
To Reproduce
Expected behavior A clear and concise description of what you expected to happen.
Environment:
Additional context include/sw/redis++/command_args.h:157:15: error: no match for 'operator<<' (operand types are 'sw::redis::CmdArgs' and 'sw::redis::Optional<std::__cxx11::basic_string >')
this << first;