Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Macros | Functions
util.hpp File Reference
#include <string>
#include <memory>
#include "inexor/util/StringFormatter.hpp"

Go to the source code of this file.

Namespaces

 inexor
 Show stacktrace on unix, do not include directly.
 
 inexor::util
 

Macros

#define INEXOR_FUNCTION_ALIAS(alias, orig)
 Create a function alias. More...
 
#define INEXOR_ATTR_UNUSED
 INEXOR_ATTR_UNUSED: Prevent the compiler from optimizing variables that are never used away. More...
 

Functions

template<typename T >
std::string inexor::util::to_string (T x)
 Convert stuff to a string. More...
 
template<typename To , typename From >
std::unique_ptr< To > inexor::util::dynamic_pointer_cast (std::unique_ptr< From > &&f) noexcept
 Moving dynamic cast for unique_ptr. More...
 
template<typename T >
std::string inexor::util::split_find_last (const std::string &s, T sep__)
 Split a string and get the last component. More...
 

Macro Definition Documentation

#define INEXOR_ATTR_UNUSED

INEXOR_ATTR_UNUSED: Prevent the compiler from optimizing variables that are never used away.

Useful, when all the interesting logic happens on the assignment right side or in the constructors/destructors.

#define INEXOR_FUNCTION_ALIAS (   alias,
  orig 
)
Value:
template <typename... Args> \
auto alias (Args&&... args) \
-> decltype( orig(std::forward<Args>(args)...)) { \
return orig(std::forward<Args>(args)...); \
}
void alias(const char *name, const char *str)
Definition: command.cpp:504

Create a function alias.

THX: https://stackoverflow.com/questions/9864125/c11-how-to-alias-a-function

Parameters
origName of the original functon
aliasName of the new alias function