add s_multiset

This commit is contained in:
chatlanin
2022-03-03 12:15:10 +03:00
parent 9d3c2a4153
commit f87a80b495
3 changed files with 16 additions and 3 deletions

View File

@@ -1,14 +1,21 @@
#pragma once
#include <vector>
#include <set>
namespace hack::container
{
template<typename Range, typename... Args>
void v_multiset(Range& r, Args... args)
{
std::size_t t = sizeof... (args);
constexpr std::size_t t = sizeof... (args);
r.reserve(t);
(r.emplace_back(std::forward<Args>(args)), ...);
}
template<typename Range, typename... Args>
void s_multiset(Range& r, Args... args)
{
(r.insert(args), ...);
}
}

View File

@@ -1,5 +1,7 @@
#include "string.hpp"
#include <iostream>
namespace hack::string
{
v_str split_str(const std::string& str, char t)
@@ -15,9 +17,7 @@ namespace hack::string
begin = ++end;
end = str.find_first_of(t, begin);
}
v.emplace_back(str.substr(begin));
return v;
}
}