Skip to content

Commit

Permalink
temp fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpond committed Jun 13, 2024
1 parent b1a59a0 commit 2019c08
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/BasicUtils/Hooking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdexcept>
#include <mutex>
#include <unordered_map>
#include <string>
#include <detours.h>

namespace Hooking {
Expand Down
2 changes: 1 addition & 1 deletion src/BasicUtils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace Utils
#endif

template<typename T>
constexpr auto TypeConvert(const T& arg)
const auto& TypeConvert(const T& arg)
{
if constexpr (std::is_same_v<T, const wchar_t*>) {
return std::wstring_view(arg);

This comment has been minimized.

Copy link
@std-move

std-move Jun 13, 2024

is this legal/defined? I thought returning a const reference to a temporary object was UB.

This comment has been minimized.

Copy link
@mrpond

mrpond Jun 14, 2024

Author Owner

I'm not 100% about it too, but take a look at std::string FormatString and std::wstring FormatString
I think compiler copy the value from callee (TypeConvert) temporary object to caller (FormatString) function

Expand Down

0 comments on commit 2019c08

Please sign in to comment.