add container v_multiset

This commit is contained in:
chatlanin
2022-03-02 12:11:21 +03:00
parent 3148ecd29e
commit 9d3c2a4153
14 changed files with 72 additions and 12 deletions

View File

@@ -0,0 +1,5 @@
#include "container.hpp"
namespace hack::container
{
}

View File

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

14
src/container/meson.build Normal file
View File

@@ -0,0 +1,14 @@
headers = ['container.hpp']
sources = ['container.cpp']
lib = library(
'container',
include_directories : inc,
install : true,
sources: [headers, sources]
)
container_dep = declare_dependency(
include_directories: inc,
link_with: lib
)

View File

@@ -2,3 +2,4 @@ inc += include_directories('.')
subdir('string')
subdir('range')
subdir('container')

View File

@@ -1,5 +1,5 @@
#include "range.hpp"
namespace hack
namespace hack::renge
{
}

View File

@@ -1,9 +1,9 @@
#pragma once
namespace hack
namespace hack::range
{
template<typename T, typename... Args>
bool within(T min, T max, Args... args)
bool within(const T min, const T max, Args... args)
{
return ((min <= args && max >= args) && ...);
// 1, 5, 2, 3, 4

View File

@@ -1,6 +1,6 @@
#include "string.hpp"
namespace hack
namespace hack::string
{
v_str split_str(const std::string& str, char t)
{

View File

@@ -3,7 +3,7 @@
#include <string>
#include <vector>
namespace hack
namespace hack::string
{
using v_str = std::vector<std::string>;