Changeset 2e9b59b for src/AST/Node.hpp


Ignore:
Timestamp:
Apr 19, 2022, 3:00:04 PM (3 years ago)
Author:
m3zulfiq <m3zulfiq@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
5b84a321
Parents:
ba897d21 (diff), bb7c77d (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:

added benchmark and evaluations chapter to thesis

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Node.hpp

    rba897d21 r2e9b59b  
    1010// Created On       : Wed May 8 10:27:04 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jun 5 9:47:00 2020
    13 // Update Count     : 6
     12// Last Modified On : Fri Mar 25 10:33:00 2022
     13// Update Count     : 7
    1414//
    1515
     
    103103
    104104/// Mutate a node field (only clones if not equal to existing value)
    105 template<typename node_t, typename parent_t, typename field_t, typename assn_t>
    106 const node_t * mutate_field( const node_t * node, field_t parent_t::* field, assn_t && val ) {
     105template<typename node_t, typename super_t, typename field_t, typename assn_t>
     106const node_t * mutate_field( const node_t * node, field_t super_t::* field, assn_t && val ) {
    107107        // skip mutate if equivalent
    108108        if ( node->*field == val ) return node;
     
    115115
    116116/// Mutate a single index of a node field (only clones if not equal to existing value)
    117 template<typename node_t, typename parent_t, typename coll_t, typename ind_t, typename field_t>
     117template<typename node_t, typename super_t, typename coll_t, typename ind_t, typename field_t>
    118118const node_t * mutate_field_index(
    119         const node_t * node, coll_t parent_t::* field, ind_t i, field_t && val
     119        const node_t * node, coll_t super_t::* field, ind_t i, field_t && val
    120120) {
    121121        // skip mutate if equivalent
     
    129129
    130130/// Mutate an entire indexed collection by cloning to accepted value
    131 template<typename node_t, typename parent_t, typename coll_t>
    132 const node_t * mutate_each( const node_t * node, coll_t parent_t::* field, Visitor & v ) {
     131template<typename node_t, typename super_t, typename coll_t>
     132const node_t * mutate_each( const node_t * node, coll_t super_t::* field, Visitor & v ) {
    133133        for ( unsigned i = 0; i < (node->*field).size(); ++i ) {
    134134                node = mutate_field_index( node, field, i, (node->*field)[i]->accept( v ) );
     
    230230        }
    231231
     232        /// Swaps the nodes contained within two pointers.
     233        void swap( ptr_base & other ) noexcept;
     234
    232235        const node_t * get() const { _check(); return  node; }
    233236        const node_t * operator->() const { _check(); return  node; }
     
    292295template< typename node_t >
    293296using readonly = ptr_base< node_t, Node::ref_type::weak >;
     297
     298/// Non-member swap that an participate in overload resolution.
     299template< typename node_t, enum Node::ref_type ref_t >
     300void swap( ptr_base< node_t, ref_t > & l, ptr_base< node_t, ref_t > & r ) {
     301        l.swap( r );
     302}
     303
    294304}
    295305
Note: See TracChangeset for help on using the changeset viewer.