Replaced for-loop with std::transform.
the build was successful Details

This commit is contained in:
tastytea 2019-03-30 22:24:15 +01:00
parent 57ec1fd23a
commit ff0bd7b906
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 9 additions and 5 deletions

View File

@ -20,11 +20,13 @@
#include <codecvt>
#include <utility>
#include <iostream>
#include <algorithm>
#include "version.hpp"
#include "debug.hpp"
#include "mastodon-cpp.hpp"
using namespace Mastodon;
return_base::operator bool()
{
if (error_code == 0)
@ -166,11 +168,13 @@ const curlpp::Forms API::maptoformdata(const parametermap &map)
}
else
{
for (const string &str : it.second)
{
formdata.push_back(
new curlpp::FormParts::Content(it.first + "[]", str));
}
std::transform(it.second.begin(), it.second.end(),
std::back_inserter(formdata),
[&it](const string &s)
{
return new curlpp::FormParts::Content
(it.first + "[]", s);
});
}
}