mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 02:08:09 +08:00
fix: #123 merge branch 'windows-nominmax'
This commit is contained in:
@@ -183,3 +183,9 @@ add_executable(test_multiple_translation_unit
|
||||
test_multiple_translation_unit_1.cpp
|
||||
test_multiple_translation_unit_2.cpp)
|
||||
target_link_libraries(test_multiple_translation_unit toml11::toml11)
|
||||
|
||||
if(WIN32)
|
||||
add_executable(test_windows test_windows.cpp)
|
||||
target_link_libraries(test_windows toml11::toml11)
|
||||
endif()
|
||||
|
||||
|
12
tests/test_windows.cpp
Normal file
12
tests/test_windows.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <windows.h>
|
||||
#include <toml.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace toml::literals::toml_literals;
|
||||
const auto data = u8R"(windows = "defines min and max as a macro")"_toml;
|
||||
|
||||
std::cout << toml::find<std::string>(data, "windows") << std::endl;
|
||||
return 0;
|
||||
}
|
@@ -498,7 +498,7 @@ inline std::string format_underline(const std::string& message,
|
||||
{
|
||||
// invalid
|
||||
// ~~~~~~~
|
||||
const auto underline_len = std::min(reg->size(), reg->line().size());
|
||||
const auto underline_len = (std::min)(reg->size(), reg->line().size());
|
||||
retval << color::bold << color::red
|
||||
<< make_string(underline_len, '~') << color::reset;
|
||||
}
|
||||
|
@@ -555,7 +555,7 @@ struct serializer
|
||||
for(const auto& item : v)
|
||||
{
|
||||
if(is_first) {is_first = false;} else {token += ',';}
|
||||
token += visit(serializer(std::numeric_limits<std::size_t>::max(),
|
||||
token += visit(serializer((std::numeric_limits<std::size_t>::max)(),
|
||||
this->float_prec_, true), item);
|
||||
}
|
||||
token += ']';
|
||||
@@ -575,7 +575,7 @@ struct serializer
|
||||
if(is_first) {is_first = false;} else {token += ',';}
|
||||
token += format_key(kv.first);
|
||||
token += '=';
|
||||
token += visit(serializer(std::numeric_limits<std::size_t>::max(),
|
||||
token += visit(serializer((std::numeric_limits<std::size_t>::max)(),
|
||||
this->float_prec_, true), kv.second);
|
||||
}
|
||||
token += '}';
|
||||
|
Reference in New Issue
Block a user