bool any_short = any_of(opts.begin(), opts.end(), [](const OptionImpl *o){ return o->get_short(); });
string::size_type maxw = 0;
- list<string> switches;
+ vector<string> switches;
for(const OptionImpl *o: opts)
{
string swtch;
maxw = max(maxw, swtch.size());
}
- list<string> pargs;
+ vector<string> pargs;
for(const ArgumentImpl *a: args)
{
string parg = format("<%s>", a->get_name());
};
bool help;
- std::list<OptionImpl *> opts;
- std::list<ArgumentImpl *> args;
+ std::vector<OptionImpl *> opts;
+ std::vector<ArgumentImpl *> args;
std::vector<std::string> args_raw;
public:
#ifndef MSP_DEBUG_BACKTRACE_H_
#define MSP_DEBUG_BACKTRACE_H_
-#include <list>
#include <ostream>
#include <string>
+#include <vector>
namespace Msp {
namespace Debug {
};
private:
- std::list<StackFrame> frames;
+ std::vector<StackFrame> frames;
public:
- const std::list<StackFrame> &get_frames() const { return frames; }
+ const std::vector<StackFrame> &get_frames() const { return frames; }
static Backtrace create();
};
rmdir(path);
}
-list<string> list_files(const Path &path)
+vector<string> list_files(const Path &path)
{
return list_filtered(path, string());
}
-list<string> list_filtered(const Path &path, const string &filter)
+vector<string> list_filtered(const Path &path, const string &filter)
{
Regex r_filter(filter);
- list<string> result;
+ vector<string> result;
DIR *dir = opendir(path.str().c_str());
if(!dir)
throw system_error("opendir");
return dir;
}
-Path path_lookup(const string &name, const list<Path> &paths)
+Path path_lookup(const string &name, const vector<Path> &paths)
{
for(const Path &p: paths)
{
Path path_lookup(const string &name)
{
const char *path = getenv("PATH");
- list<string> dirs = split(path, ITEMSEP);
- return path_lookup(name, list<Path>(dirs.begin(), dirs.end()));
+ vector<string> dirs = split(path, ITEMSEP);
+ return path_lookup(name, vector<Path>(dirs.begin(), dirs.end()));
}
} // namespace FS
#ifndef MSP_FS_DIR_H_
#define MSP_FS_DIR_H_
-#include <list>
#include <stdexcept>
#include <string>
+#include <vector>
#include "path.h"
namespace Msp {
void rmpath(const Path &path);
/// Lists the contents of a directory
-std::list<std::string> list_files(const Path &path);
+std::vector<std::string> list_files(const Path &path);
/// Lists the contents of a directory, filtered with a regex
-std::list<std::string> list_filtered(const Path &path, const std::string &filter);
+std::vector<std::string> list_filtered(const Path &path, const std::string &filter);
/// Returns the current working directory
Path getcwd();
/** Looks for a file in a list of paths. Returns the absolute path to the
first existing location, or an empty Path if the file is not found at all. */
-Path path_lookup(const std::string &, const std::list<Path> &);
+Path path_lookup(const std::string &, const std::vector<Path> &);
/** Looks for a file using the PATH environment variable. */
Path path_lookup(const std::string &);
#include <cstdio>
+#include <deque>
#include <unistd.h>
#include <msp/core/systemerror.h>
#include "dir.h"
Path realpath(const Path &path)
{
- list<string> queue(path.begin(), path.end());
+ deque<string> queue(path.begin(), path.end());
if(!path.is_absolute())
{
Path cwd = getcwd();
result /= c;
else
{
- list<string> files;
+ vector<string> files;
if(result.size())
files = list_files(result);
else
#include <limits>
#include <list>
#include <stack>
+#include <vector>
#include "format.h"
#include "regex.h"
}
else
{
- list<Code> branches;
+ vector<Code> branches;
for(auto i=iter;;)
{
branches.push_back(compile(expr, i, group, true));