// A value of type T1 can be converted to a type T2 if they are // similar and... something about the cv-signature. // // Note that the top-level cv-qualifiers can be removed by this // conversion since it applies to values (i.e., copies). Expr& convert_qualifier(Expr& e, Type& t) { if (is_similar(e.type(), t)) { Qualifier_list sa = get_qualification_signature(e.type()); Qualifier_list sb = get_qualification_signature(t); if (can_convert_signature(sa, sb)) return *new Qualification_conv(t, e); } return e; }
// Returns the qualification singature of `t`. Qualifier_list get_qualification_signature(Type const& t) { Qualifier_list s; get_qualification_signature(t, s); std::reverse(s.begin(), s.end()); // We built the list backwards return s; }
// Returns the qualification singature of `t`. Qualifier_list get_qualification_signature(Type const& t) { Qualifier_list s; get_qualification_signature(t, s); // The list is built backwards. Reverse it. std::reverse(s.begin(), s.end()); return s; }
void operator()(Sequence_type const& t) { get_qualification_signature(t.type(), sig); }
void operator()(Pointer_type const& t) { get_qualification_signature(t.type(), sig); }