bool ndt::dim_fragment_type::operator==(const base_type &rhs) const {
  if (this == &rhs) {
    return true;
  } else if (rhs.get_id() != dim_fragment_id) {
    return false;
  } else {
    const dim_fragment_type *dft = static_cast<const dim_fragment_type *>(&rhs);
    return get_ndim() == rhs.get_ndim() &&
           memcmp(m_tagged_dims.get(), dft->m_tagged_dims.get(), get_ndim() * sizeof(intptr_t)) == 0;
  }
}