#pragma once #include #include namespace frob { using u8 = unsigned char; constexpr static const u8 ROT13_CONSTANT = #ifdef FROB_CONSTANT (u8)(FROB_CONSTANT) #else (u8)42; #endif constexpr inline u8 rot13(u8 i) { return i ^ ROT13_CONSTANT; } template requires(N > 0) struct cfrob { CHAR out[N]{}; inline constexpr operator const char*() const { return out; } inline operator char*() { return out; } constexpr cfrob(const CHAR (&sz)[N]) { for(std::size_t i=0;i constexpr auto memfrob(const u8 (&sz)[N]) { return cfrob(sz); } template inline auto memfrob(u8 (&sz)[N]) { for(std::size_t i=0;i inline P* memfrob(u8* ptr, std::size_t len) { for(auto i=0;i memfrob(const u8* ptr, std::size_t len) { std::vector out; out.reserve(len); for(std::size_t i=0;i& memfrob(std::vector* _s) { std::vector& s = *_s; for(auto& b : s) b = rot13(b); return s; } inline std::vector memfrob(const std::vector& s) { std::vector out = s; memfrob(out); return out; } template constexpr inline auto strfrob(const char (&sz)[N]) { return cfrob(sz); } inline std::string strfrob(const std::string& s) { std::string out; out.reserve(s.size()); for(const char& c : s) out+= rot13((u8)c); return out; } inline std::string& strfrob(std::string* sp) { std::string& s = *sp; for(char& c : s) c = rot13((u8)c); return s; } inline std::string strfrob(const char* str) { return strfrob(std::string(str)); } inline char* strfrob(char* str) { for(;*str;str++) *str = rot13((u8)*str); return str; } } template constexpr auto operator "" _frob() { return C.out; }