Skip to content

Commit

Permalink
namespace: use auto-string conversion for path generation
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJJ committed Jul 2, 2023
1 parent fafc2ce commit c780d81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 4 additions & 8 deletions nyan/namespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,15 @@ const std::vector<std::string> &Namespace::get_obj_components() const {
std::string Namespace::to_dirpath() const {
return util::strjoin(
"/",
this->dir_components,
[](const auto &in) -> const std::string & {
return in;
});
this->dir_components
);
}

std::string Namespace::to_filepath() const {
std::string ret = util::strjoin(
"/",
this->dir_components,
[](const auto &in) -> const std::string & {
return in;
});
this->dir_components
);

if (not this->filename.empty()) {
ret += "/" + this->filename + extension;
Expand Down
7 changes: 3 additions & 4 deletions nyan/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,13 @@ strjoin(
func=&stream_container_elem<typename T::value_type>
) {

bool delim_active = false;
for (auto &entry : container) {
if (delim_active) {
for (bool use_delim = false; auto &entry : container) {
if (use_delim) {
builder << delim;
}

func(builder, entry);
delim_active = true;
use_delim = true;
}

return builder;
Expand Down

0 comments on commit c780d81

Please sign in to comment.