Beispiel #1
0
// Initialize the substitution with a mapping from each
// `pi` in `p` to its corresponding `ai` in `a`.
inline
Substitution::Substitution(Decl_list& p, Term_list& a)
{
  auto pi = p.begin();
  auto ai = a.begin();
  while (pi != p.end()) {
    send(*pi, *ai);
    ++pi;
    ++ai;
  }
}
Beispiel #2
0
// Return a list of converted template arguments.
Term_list
initialize_template_parameters(Context& cxt, Decl_list& parms, Term_list& args)
{
  // TODO: Handle default arguments here.
  if (args.size() < parms.size())
    throw std::runtime_error("too few template arguments");

  // Build a list of converted template arguments by initializing
  // each parameter in turn.
  Term_list ret;
  Decl_iter p0 = parms.begin(), pi = p0, pn = parms.end();
  Term_iter a0 = args.begin(), ai = a0, an = args.end();
  while (pi != pn && ai != an) {
    Term& e = initialize_template_parameter(cxt, p0, pi, a0, ai);

    // TODO: If pi is a pack, then we want to merge e into
    // a single pack argument so that so that the number of
    // parameters and arguments conform.
    ret.push_back(e);
  }

  return ret;
}