What are the methods to achieve inline code in C++? I can only think about macros and inline functions. Are there more alternatives in C++11/17/20 (e.g. lambda) ? Advantages and disadvantages?
// do macros still make sense in modern C++ standards?
#define square(x) ((x)*(x))
// is this a good alternative to macros?
template <class T> inline T square(T x) { return x * x; }
EDIT: changed comment from "are macros still encouraged...?" to "do macros still make sense...?"