Skip to content

Commit

Permalink
Add missing conversion to uint64_t (#762)
Browse files Browse the repository at this point in the history
This can cause problems with some compilers

Signed-off-by: Kai-Uwe Hermann <[email protected]>
  • Loading branch information
hikinggrass authored Aug 27, 2024
1 parent fb4d430 commit 2bc64f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.14)

project(ocpp
VERSION 0.16.1
VERSION 0.16.2
DESCRIPTION "A C++ implementation of the Open Charge Point Protocol"
LANGUAGES CXX
)
Expand Down
5 changes: 4 additions & 1 deletion include/ocpp/v201/device_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ template <typename T> struct RequestDeviceModelResponse {
template <typename T> T to_specific_type(const std::string& value) {
static_assert(std::is_same<T, std::string>::value || std::is_same<T, int>::value ||
std::is_same<T, double>::value || std::is_same<T, size_t>::value ||
std::is_same<T, DateTime>::value || std::is_same<T, bool>::value,
std::is_same<T, DateTime>::value || std::is_same<T, bool>::value ||
std::is_same<T, uint64_t>::value,
"Requested unknown datatype");

if constexpr (std::is_same<T, std::string>::value) {
Expand All @@ -43,6 +44,8 @@ template <typename T> T to_specific_type(const std::string& value) {
return DateTime(value);
} else if constexpr (std::is_same<T, bool>::value) {
return ocpp::conversions::string_to_bool(value);
} else if constexpr (std::is_same<T, uint64_t>::value) {
return std::stoull(value);
}
}

Expand Down

0 comments on commit 2bc64f0

Please sign in to comment.