Spaces:
Runtime error
Runtime error
Raylib C++ Wrapper but I'm 18
#37
by
needlesslygrim
- opened
Question:
Context: I am under 18, please use that information in your responses.
I have a function:
inline bool IsKeyDown(std::same_as auto... keys) { return (::IsKeyDown(KeyCodeToRaylibKey(keys)) || ...); }
It uses the concept std::same_as from the header file, part of the standard library. How do I convert it to not using the auto keywoard, and being something like this:
template <std::same_as T>
inline bool IsKeyDown(T... keys)
Answer:
Context: I am under 18, please use that information in your responses. I have a function: inline bool IsKeyDown(std::same_as auto... keys) { return (::IsKeyDown(KeyCodeToRaylibKey(keys)) || ...); } It uses the concept std::same_as from the header file, part of the standard library. How do I convert it to not using the auto keywoard, and being something like this: template T> inline bool IsKeyDown(T... keys) { for (auto i : keys){ if(::IsKeyDown(i)){ return true; } } return false; } """ def main(): #print("Hello World") print("""#include "raylib-cpp/raylib-cpp.hpp" // raylib-cpp is included here automatically by CMake """) with open('keycodes.txt', 'r') as f: lines = [line[:-2] + ",\n" for line in list(f)] text = "".join([str(x) for x in lines]) print("\nenum class KeyCode {\n NONE,\n"+text+"}\n;\n") """ template struct same_type {}; static constexpr same_type int{}; static constexpr same_type float{}; static constexpr same_type double{}; static constexpr same_type bool{}; static constexpr same_type char32_t{}; static constexpr same_type wchar_t{}; static constexpr same_type voidp{}; static constexpr