Ignore:
Timestamp:
Jul 25, 2017, 10:41:24 AM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
d335627
Parents:
9191a8e
Message:

Add unsafe_group_iterate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    r9191a8e r6d267ca  
    310310template< typename T1, typename T2 >
    311311struct group_iterate_t {
    312         group_iterate_t( const T1 & v1, const T2 & v2 ) : args(v1, v2) {
    313                 assertf(v1.size() == v2.size(), "group iteration requires containers of the same size.");
     312        group_iterate_t( bool skipBoundsCheck, const T1 & v1, const T2 & v2 ) : args(v1, v2) {
     313                assertf(skipBoundsCheck || v1.size() == v2.size(), "group iteration requires containers of the same size: <%u, %u>.", v1.size(), v2.size());
    314314        };
    315315
     
    336336};
    337337
     338/// performs bounds check to ensure that all arguments are of the same length.
    338339template< typename... Args >
    339340group_iterate_t<Args...> group_iterate( Args &&... args ) {
    340         return group_iterate_t<Args...>(std::forward<Args>( args )...);
     341        return group_iterate_t<Args...>(false, std::forward<Args>( args )...);
     342}
     343
     344/// does not perform a bounds check - requires user to ensure that iteration terminates when appropriate.
     345template< typename... Args >
     346group_iterate_t<Args...> unsafe_group_iterate( Args &&... args ) {
     347        return group_iterate_t<Args...>(true, std::forward<Args>( args )...);
    341348}
    342349
Note: See TracChangeset for help on using the changeset viewer.