示例#1
0
文件: hash.cpp 项目: asutton/beaker
/// Hash the name `n` into `h`.
void
hash_algo::operator()(hasher& h, const name& n) const
{
  switch (n.get_kind()) {
    case basic_name_kind:
      return hash(h, cast<basic_name>(n).get_symbol());
    case internal_name_kind:
      return hash(h, cast<internal_name>(n).get_id());
    default:
      break;
  }
  assert(false && "name not a core name");
}
示例#2
0
文件: eq.cpp 项目: asutton/beaker
/// This feature does not define names.
bool
eq_algo::operator()(const name& a, const name& b) const
{
  switch (a.get_kind()) {
    case basic_name_kind:
      return eq_basic_name(cast<basic_name>(a), cast<basic_name>(b));
    case internal_name_kind:
      return eq_internal_name(cast<internal_name>(a), cast<internal_name>(b));
    default:
      break;
  }
  assert(false && "not a core name");
}
示例#3
0
文件: print.cpp 项目: asutton/beaker
void
print_algo::operator()(std::ostream& os, const name& n) const
{
  switch (n.get_kind()) {
    case basic_name_kind:
      os << cast<basic_name>(n).get_symbol().get_spelling();
      return;
    case internal_name_kind:
      os << "<internal>";
      return;
    default:
      break;
  }
  assert(false && "not a core name");
}