Skip to content

Commit 46707ac

Browse files
committed
Vutils
1 parent cc0b5e2 commit 46707ac

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

Test/Sample.RESTClient.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ DEF_SAMPLE(RESTClient)
2323
std::cout << response.text << std::endl;
2424

2525
// create one
26-
rest_client.post(ts("/api/v1/customers"), response, R"({"name":"name 5","phone":"phone 5"})", header);
26+
rest_client.post(ts("/api/v1/customers"), response, "{\"name\":\"name 5\",\"phone\":\"phone 5\"}", header);
2727
std::cout << vu::decode_const_http_status_A(response.status) << std::endl;
2828
std::cout << response.text << std::endl;
2929

@@ -33,7 +33,7 @@ DEF_SAMPLE(RESTClient)
3333
std::cout << response.text << std::endl;
3434

3535
// update one
36-
rest_client.put(ts("/api/v1/customers/5"), response, R"({"name":"name 5-x","phone":"phone 5-x"})", header);
36+
rest_client.put(ts("/api/v1/customers/5"), response, "{\"name\":\"name 5-x\",\"phone\":\"phone 5-x\"}", header);
3737
std::cout << vu::decode_const_http_status_A(response.status) << std::endl;
3838
std::cout << response.text << std::endl;
3939

Test/Sample.String.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,13 @@ DEF_SAMPLE(String)
9292
}
9393
}
9494

95-
std::vector<std::tstring> strings = { ts("ape"), ts("apple"), ts("peach"), ts("puppy") };
95+
std::vector<std::tstring> strings;
96+
{
97+
strings.push_back(ts("ape"));
98+
strings.push_back(ts("apple"));
99+
strings.push_back(ts("peach"));
100+
strings.push_back(ts("puppy"));
101+
}
96102
auto closest_string = vu::find_closest_string(ts("aple"), strings);
97103
assert(closest_string == ts("apple"));
98104

include/Vutils.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -3296,12 +3296,13 @@ class ThreadPool
32963296
* Scoped_<handle>
32973297
*/
32983298

3299-
#if defined(_MSC_VER)
3299+
// C++14 (MSVC 2015+ or MinGW 5.1+)
3300+
#if (defined(_MSC_VER) && _MSC_VER >= 1900) || (defined(__MINGW32__) && __cplusplus >= 201402L)
33003301
#include "template/handle.tpl"
33013302
ScopedHandleT_Define(HANDLE, HANDLE, INVALID_HANDLE_VALUE, { CloseHandle(h); });
33023303
ScopedHandleT_Define(NULL_HANDLE, HANDLE, nullptr, { CloseHandle(h); });
33033304
ScopedHandleT_Define(FILE, FILE*, nullptr, { fclose(h); });
3304-
#endif // _MSC_VER
3305+
#endif
33053306

33063307
/**
33073308
* Path

include/template/singleton.tpl

+3
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ public:
2626
}
2727
}
2828

29+
// C++14 (MSVC 2013+ or MinGW 4.6+)
30+
#if (defined(_MSC_VER) && _MSC_VER >= 1800) || (defined(__MINGW32__) && __cplusplus >= 201103L)
2931
SingletonT(SingletonT&&) = delete;
3032
SingletonT(SingletonT const&) = delete;
3133
SingletonT& operator=(SingletonT&&) = delete;
3234
SingletonT& operator=(SingletonT const&) = delete;
35+
#endif
3336

3437
static T& instance()
3538
{

src/details/strfmt.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ std::unique_ptr<byte[]> VariantT<T>::to_bytes() const
771771
}
772772

773773
std::unique_ptr<byte[]> result(new byte[bytes.size()]);
774-
std::move(bytes.cbegin(), bytes.cend(), result.get());
774+
for (size_t i = 0; i < bytes.size(); i++) result.get()[i] = bytes[i]; // std::move(bytes.cbegin(), bytes.cend(), result.get());
775775
return result;
776776
}
777777

0 commit comments

Comments
 (0)