diff --git a/include/cista/containers/bitvec.h b/include/cista/containers/bitvec.h index 529bbb85..66113ecf 100644 --- a/include/cista/containers/bitvec.h +++ b/include/cista/containers/bitvec.h @@ -53,6 +53,12 @@ struct basic_bitvec { } } + void one_out() { + for (auto& b : blocks_) { + b = ~block_t{0}; + } + } + void resize(size_type const new_size) { if (new_size == size_) { return; diff --git a/include/cista/targets/file.h b/include/cista/targets/file.h index 90319044..012946c0 100644 --- a/include/cista/targets/file.h +++ b/include/cista/targets/file.h @@ -10,6 +10,7 @@ #include #include #include +#include #endif #include @@ -27,27 +28,7 @@ namespace cista { inline std::string last_error_str() { - auto const err = ::GetLastError(); - if (err == 0) { - return "no error"; - } - - struct buf { - ~buf() { - if (b_ != nullptr) { - LocalFree(b_); - b_ = nullptr; - } - } - LPSTR b_ = nullptr; - } b; - auto const size = FormatMessageA( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), b.b_, 0, - nullptr); - - return size == 0 ? std::to_string(err) : std::string{b.b_, size}; + return std::system_category().message(static_cast(::GetLastError())); } inline HANDLE open_file(char const* path, char const* mode) {