add container v_multiset
This commit is contained in:
5
src/container/container.cpp
Normal file
5
src/container/container.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "container.hpp"
|
||||
|
||||
namespace hack::container
|
||||
{
|
||||
}
|
||||
14
src/container/container.hpp
Normal file
14
src/container/container.hpp
Normal 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
14
src/container/meson.build
Normal 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
|
||||
)
|
||||
@@ -2,3 +2,4 @@ inc += include_directories('.')
|
||||
|
||||
subdir('string')
|
||||
subdir('range')
|
||||
subdir('container')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "range.hpp"
|
||||
|
||||
namespace hack
|
||||
namespace hack::renge
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "string.hpp"
|
||||
|
||||
namespace hack
|
||||
namespace hack::string
|
||||
{
|
||||
v_str split_str(const std::string& str, char t)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace hack
|
||||
namespace hack::string
|
||||
{
|
||||
using v_str = std::vector<std::string>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user