skystrife / cpptoml

cpptoml is a header-only library for parsing TOML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assigning to auto&& does some funky things

mika314 opened this issue · comments

This snippet does not work properly all the time:

auto &&version = library->get_as<std::string>("version").value_or("master");

Sometimes it works sometimes it does not.

Workaround: do std::string instead auto &&, like this:

std::string version = library->get_as<std::string>("version").value_or("master");

You cannot return by reference here, because alternative may be rvalue:

return alternative;

Good catch! Should be fixed in 415b33f.