/* Title: C++ Aliasing Library Author: Edward R. Gonzalez Date: Description: This is a segment of the C++ Assist Library I use for other code. This merely removes the need to use operators I don't like and wraps them in easier to manage typedefs, functions or macros */ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // Macros #define sfn \ auto #define deduce \ auto #define Ref(_type) \ _type& #define rRef(_type) \ _type&& // Aliases // Fundamental using uInt64 = unsigned long long int; // Pointers template using ptr = Type*; template using FnPtr = ReturnType(*)(ParamTypes...); template using Delegate = std::function; template using Func = ReturnType(ParamTypes...); template using UPtr = std::unique_ptr; template using SPtr = std::shared_ptr; // Strings template using RawString = ptr; using std::cout; using std::endl; using DataSize = std::size_t; using Thread = std::thread; template using Tuple = std::tuple; // Enum enum class ExitCode { Success = EXIT_SUCCESS, Failed = EXIT_FAILURE }; // Functions // Ptr template sfn Address(Ref(Type) _instance) -> ptr { return &_instance; } template sfn Dref(ptr _type) -> Ref(Type) { return *_type; } template sfn MakeUPtr(rRef(ParamTypes)... _params) -> UPtr { return std::make_unique(_params...); } template sfn MakeSPtr(rRef(ParamTypes)... _params) -> SPtr { return std::make_shared(_params...); } // Exit sfn Exit(ExitCode _code) { exit(int(_code)); } // Error Stuff sfn ErrorRuntime(const Ref(std::runtime_error) _error) { std::cout << "Runtime error occurred: " << _error.what() << std::endl; return; }