Changes in src/ResolvExpr/Candidate.hpp [432ce7a:99d4584]
- File:
-
- 1 edited
-
src/ResolvExpr/Candidate.hpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Candidate.hpp
r432ce7a r99d4584 30 30 /// A list of unresolved assertions 31 31 using AssertionList = std::vector<AssertionSet::value_type>; 32 33 /// Convenience to merge AssertionList into AssertionSet34 static inline void mergeAssertionSet( AssertionSet & dst, const AssertionList & src ) {35 for ( const auto & s : src ) { dst.emplace( s ); }36 }37 32 } 38 33 … … 47 42 ast::OpenVarSet open; ///< Open variables for environment 48 43 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() ) {}64 44 }; 65 45 … … 69 49 /// List of candidates 70 50 using CandidateList = std::vector< CandidateRef >; 71 72 /// Splice src after dst, clearing src73 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 dst80 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 candidates86 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 }98 51 99 52 void print( std::ostream & os, const Candidate & cand, Indenter indent = {} );
Note:
See TracChangeset
for help on using the changeset viewer.