Began working on mfem_resolver formatters
This commit is contained in:
19
src/include/serif/utils/format/strings.hpp
Normal file
19
src/include/serif/utils/format/strings.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <span>
|
||||
#include <format>
|
||||
#include <type_traits>
|
||||
|
||||
namespace serif::utils::misc::format {
|
||||
template <typename T>
|
||||
std::string join(const std::span<T>& elements, std::string_view delimiter)
|
||||
{
|
||||
std::string out;
|
||||
for (const auto& element : elements) {
|
||||
out = std::format("{}{}{}", out, delimiter, element);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user