Use const T & arg
if sizeof(T)>sizeof(void*)
and use T arg
if sizeof(T) <= sizeof(void*)
More Related Contents:
- How do I compare chars (or strings) using void functions, also comparing chars that were taken from a struct array
- Function Recurssion: [duplicate]
- What are all the common undefined behaviours that a C++ programmer should know about? [closed]
- Selectively disable GCC warnings for only part of a translation unit
- Copy constructor for a class with unique_ptr
- Why does typeid.name() return weird characters using GCC and how to make it print unmangled names?
- Cannot find or open the PDB file in Visual Studio C++ 2010
- C++ implicit copy constructor for a class that contains other objects
- Floating point equality and tolerances
- How to ‘cout’ the correct number of decimal places of a double value?
- Detect 32-bit or 64-bit of Windows
- The copy constructor and assignment operator
- std::map, pointer to map key value, is this possible?
- Why does the most negative int value cause an error about ambiguous function overloads?
- Can I write C++ code without headers (repetitive function declarations)?
- Why does a std::atomic store with sequential consistency use XCHG?
- Similar String algorithm
- How can I use an array as map value?
- How to read / write a struct in Binary Files?
- When to use new and delete
- Using CMake to generate Visual Studio C++ project files
- How to target Windows XP in Microsoft Visual Studio C++ [duplicate]
- How do I find the current system timezone?
- Return a named object of a class from a function (by value ) and implicit move rule?
- Most terse and reusable way of wrapping template or overloaded functions in function objects
- How do you add a timed delay to a C++ program?
- How can I expand call to variadic template base classes?
- What lasts after using std::move c++11
- undefined reference to `pthread_key_create’ (linker error)
- Why do we need to tie std::cin and std::cout?