Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10976 for code


Ignore:
Timestamp:
Dec 25, 2015, 9:07:12 PM (9 years ago)
Author:
muemart
Message:

Add some static asserts

Location:
code/branches/cpp11_v2/src/libraries/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/util/Math.h

    r10818 r10976  
    181181    inline T zeroise()
    182182    {
    183         // Default, raise a compiler error without including large boost header cascade.
    184         T temp{};
    185         *********temp; // If you reach this code, you abused zeroise()!
     183        static_assert(sizeof(T) != sizeof(T), "No template specialization available for T");
    186184        return temp;
    187185    }
  • code/branches/cpp11_v2/src/libraries/util/MultiType.h

    r10845 r10976  
    428428            }
    429429            /// Creates a new value container (works only with specialized types).
    430             template <typename T> inline void createNewValueContainer(const T& value) { /* STATIC ASSERT */ *****value; }
     430            template <typename T> inline void createNewValueContainer(const T& value)
     431            {
     432                static_assert(sizeof(T) != sizeof(T), "No template specialization available for T");
     433            }
    431434
    432435            MT_ValueBase* value_; //!< A pointer to the value container
Note: See TracChangeset for help on using the changeset viewer.