Skip to content

Commit

Permalink
Merge pull request #5 from SimonCROS/4-boost-headers-not-found
Browse files Browse the repository at this point in the history
Fix: #4 boost headers not found
  • Loading branch information
SimonCROS authored Nov 12, 2024
2 parents aad93df + 5be96e0 commit fcd0d77
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
18 changes: 18 additions & 0 deletions includes/complexity.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef COMPLEXITY_H
#define COMPLEXITY_H

#include <sstream>
#include <iterator>
#include <string>
#include <optional>
#include <random>
Expand Down Expand Up @@ -39,4 +41,20 @@ void printStart(const program_opts& opts, const program_params& params);
void print_status(const program_params& params, int done, int mean, double stddev, int best, int worst, int successful, int ok);
void printEnd(const program_opts& opts, const program_params& params);

template <typename Range, typename Value = typename Range::value_type>
std::string join(Range const& elements, const char *const delimiter) {
std::ostringstream os;
auto b = begin(elements), e = end(elements);

if (b != e) {
std::copy(b, prev(e), std::ostream_iterator<Value>(os, delimiter));
b = prev(e);
}
if (b != e) {
os << *b;
}

return os.str();
}

#endif
2 changes: 1 addition & 1 deletion src/exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ string exec(char **argv, optional<string> input) {
pipe(pipes[PARENT_READ_PIPE]);
pipe(pipes[PARENT_WRITE_PIPE]);

if(fork() == 0) {
if(fork() == 0) {
dup2(CHILD_READ_FD, STDIN_FILENO);
dup2(CHILD_WRITE_FD, STDOUT_FILENO);
dup2(CHILD_WRITE_FD, STDERR_FILENO);
Expand Down
5 changes: 2 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <langinfo.h>
#include <signal.h>
#include <boost/algorithm/string/join.hpp>

using namespace std;

Expand Down Expand Up @@ -98,7 +97,7 @@ void launchTest()
if (opts.output.has_value() && !input_saved)
{
input_saved = true;
error_inputs.push_back(boost::algorithm::join(args, " "));
error_inputs.push_back(join(args, " "));
}
}
}
Expand All @@ -115,7 +114,7 @@ void launchTest()
if (opts.output.has_value() && !input_saved)
{
input_saved = true;
failed_inputs.push_back(boost::algorithm::join(args, " "));
failed_inputs.push_back(join(args, " "));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/print.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void showCursor() {
}

const string getVersion() {
return "Complexity 1.7.0 (2024-04-19)";
return "Complexity 1.7.1 (2024-11-12)";
}

const string getUsage() {
Expand Down

0 comments on commit fcd0d77

Please sign in to comment.