Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Candidate.hpp

    r432ce7a r99d4584  
    3030        /// A list of unresolved assertions
    3131        using AssertionList = std::vector<AssertionSet::value_type>;
    32 
    33         /// Convenience to merge AssertionList into AssertionSet
    34         static inline void mergeAssertionSet( AssertionSet & dst, const AssertionList & src ) {
    35                 for ( const auto & s : src ) { dst.emplace( s ); }
    36         }
    3732}
    3833
     
    4742        ast::OpenVarSet open;      ///< Open variables for environment
    4843        ast::AssertionList need;   ///< Assertions which need to be resolved
    49 
    50         Candidate() : expr(), cost( Cost::zero ), cvtCost( Cost::zero ), env(), open(), need() {}
    51        
    52         Candidate( const ast::Expr * x, const ast::TypeEnvironment & e )
    53         : expr( x ), cost( Cost::zero ), cvtCost( Cost::zero ), env( e ), open(), need() {}
    54 
    55         Candidate( const Candidate & o, const ast::Expr * x )
    56         : expr( x ), cost( o.cost ), cvtCost( Cost::zero ), env( o.env ), open( o.open ),
    57           need( o.need ) {}
    58        
    59         Candidate(
    60                 const ast::Expr * x, ast::TypeEnvironment && e, ast::OpenVarSet && o,
    61                 ast::AssertionSet && n, const Cost & c )
    62         : expr( x ), cost( c ), cvtCost( Cost::zero ), env( std::move( e ) ), open( std::move( o ) ),
    63           need( n.begin(), n.end() ) {}
    6444};
    6545
     
    6949/// List of candidates
    7050using CandidateList = std::vector< CandidateRef >;
    71 
    72 /// Splice src after dst, clearing src
    73 static inline void splice( CandidateList & dst, CandidateList & src ) {
    74         dst.reserve( dst.size() + src.size() );
    75         for ( CandidateRef & r : src ) { dst.emplace_back( std::move( r ) ); }
    76         src.clear();
    77 }
    78 
    79 /// Splice src before dst
    80 static inline void spliceBegin( CandidateList & dst, CandidateList & src ) {
    81         splice( src, dst );
    82         dst.swap( src );
    83 }
    84 
    85 /// Sum the cost of a list of candidates
    86 static inline Cost sumCost( const CandidateList & candidates ) {
    87         Cost total = Cost::zero;
    88         for ( const CandidateRef & r : candidates ) { total += r->cost; }
    89         return total;
    90 }
    91 
    92 /// Holdover behaviour from old `findMinCost` -- xxx -- can maybe be eliminated?
    93 static inline void promoteCvtCost( CandidateList & candidates ) {
    94         for ( CandidateRef & r : candidates ) {
    95                 r->cost = r->cvtCost;
    96         }
    97 }
    9851
    9952void print( std::ostream & os, const Candidate & cand, Indenter indent = {} );
Note: See TracChangeset for help on using the changeset viewer.