Merge branch 'master' into multi-target-windows-api

This commit is contained in:
Greg Beard 2018-10-22 11:09:10 +01:00
commit 3338d0ddaf
3 changed files with 19 additions and 4 deletions

View File

@ -26,10 +26,21 @@
namespace mio {
namespace detail {
template<typename String> struct is_c_str
template <typename String>
struct is_c_str
{
static constexpr bool value = std::is_same<
const char*, typename std::decay<String>::type
char*,
// TODO: I'm so sorry for this... Can this be made cleaner?
typename std::add_pointer<
typename std::remove_cv<
typename std::remove_pointer<
typename std::decay<
String
>::type
>::type
>::type
>::type
>::value;
};

View File

@ -326,7 +326,7 @@ private:
}
else
{
pimpl_->map(token, offset, length, AccessMode, error);
pimpl_->map(token, offset, length, error);
}
}
};

View File

@ -22,7 +22,11 @@ using mmap_source = mio::basic_mmap_source<std::byte>;
int main()
{
const char* path = "test-file";
const char _path[] = "test-file";
// Make sure mio compiles with non-const char* strings too.
const int path_len = sizeof(_path);
char* path = new char[path_len];
std::copy(_path, _path + path_len, path);
std::error_code error;
// Fill buffer, then write it to file.
std::string buffer(0x4000 - 250, 'M');