fix const
This commit is contained in:
parent
ed20a19521
commit
fe02073b12
@ -181,5 +181,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
{// ex: utils::exec
|
||||
hack::log()(hack::utils::exec("ls"));
|
||||
hack::log()(hack::utils::exec("pwd"));
|
||||
auto t = hack::utils::exec("pwd");
|
||||
hack::log::type_trace(t);
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace hack::iterators
|
||||
|
||||
private:
|
||||
std::basic_ostream<char, traits>* os_;
|
||||
const std::string devider_ = ", ";
|
||||
std::string devider_ = ", ";
|
||||
std::size_t size_;
|
||||
|
||||
public:
|
||||
|
@ -5,17 +5,17 @@ namespace hack
|
||||
std::string log::devider = " ";
|
||||
int log::count = 0;
|
||||
|
||||
log::log(const std::string devider_, std::experimental::source_location location_) : location { location_ }
|
||||
log::log(std::string devider_, std::experimental::source_location location_) : location { location_ }
|
||||
{
|
||||
this->devider = devider_;
|
||||
}
|
||||
|
||||
warn::warn(const std::string devider_, std::experimental::source_location location_) : location { location_ }
|
||||
warn::warn(std::string devider_, std::experimental::source_location location_) : location { location_ }
|
||||
{
|
||||
this->devider = devider_;
|
||||
}
|
||||
|
||||
error::error(const std::string devider_, std::experimental::source_location location_) : location { location_ }
|
||||
error::error(std::string devider_, std::experimental::source_location location_) : location { location_ }
|
||||
{
|
||||
this->devider = devider_;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace hack
|
||||
class log
|
||||
{
|
||||
public:
|
||||
log(const std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current());
|
||||
log(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current());
|
||||
log(log&) = delete;
|
||||
log(log&&) = delete;
|
||||
|
||||
@ -135,7 +135,7 @@ namespace hack
|
||||
class warn : public log
|
||||
{
|
||||
public:
|
||||
warn(const std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current());
|
||||
warn(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current());
|
||||
warn(log&) = delete;
|
||||
warn(log&&) = delete;
|
||||
|
||||
@ -162,7 +162,7 @@ namespace hack
|
||||
class error : public log
|
||||
{
|
||||
public:
|
||||
error(const std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current());
|
||||
error(std::string devider_ = ", ", std::experimental::source_location location_ = std::experimental::source_location::current());
|
||||
error(log&) = delete;
|
||||
error(log&&) = delete;
|
||||
|
||||
|
@ -70,7 +70,7 @@ namespace hack::string
|
||||
};
|
||||
|
||||
template <typename Stream, typename... Strings>
|
||||
Stream& operator<<(Stream& stream, const string_concat_helper<Strings...> strings)
|
||||
Stream& operator<<(Stream& stream, string_concat_helper<Strings...> strings)
|
||||
{
|
||||
return stream << static_cast<std::string>(strings);
|
||||
}
|
||||
|
@ -48,13 +48,13 @@ namespace hack::utils
|
||||
|
||||
inline std::string exec(const char* cmd)
|
||||
{
|
||||
std::array<char, 128> buffer;
|
||||
std::string result;
|
||||
std::array<char, 128> buffer;
|
||||
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose);
|
||||
|
||||
if (!pipe)
|
||||
{
|
||||
throw std::runtime_error("popen() failed!");
|
||||
throw std::runtime_error("bash cmd failed");
|
||||
}
|
||||
|
||||
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr)
|
||||
|
Loading…
Reference in New Issue
Block a user