Ignore:
Timestamp:
May 27, 2019, 11:08:54 AM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
f88a252
Parents:
933f32f (diff), 21a44ca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/include/cassert

    r933f32f rd908563  
    99// Author           : Peter A. Buhr
    1010// Created On       : Thu Aug 18 13:19:26 2016
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug  1 11:56:01 2017
    13 // Update Count     : 16
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu May 23 15:30:00 2017
     13// Update Count     : 17
    1414//
    1515
     
    1919
    2020#include_next <cassert>
     21
     22#include <string>
     23
     24template < typename ... Params >
     25std::string toString( const Params & ... params );
    2126
    2227#ifdef NDEBUG
     
    3843#endif
    3944
    40 template<typename T, typename U>
     45enum StrictAllowNull {NonNull, AllowNull};
     46
     47template<typename T, StrictAllowNull nullable = NonNull, typename U>
    4148static inline T strict_dynamic_cast( const U & src ) {
     49        if (nullable == AllowNull && src == nullptr) {
     50                return nullptr;
     51        }
     52        assert(src);
    4253        T ret = dynamic_cast<T>(src);
    4354        assertf(ret, "%s", toString(src).c_str());
Note: See TracChangeset for help on using the changeset viewer.