QMCPACK / qmcpack

Main repository for QMCPACK, an open-source production level many-body ab initio Quantum Monte Carlo code for computing the electronic structure of atoms, molecules, and solids with full performance portable GPU support
http://www.qmcpack.org
Other
297 stars 139 forks source link

Base class type alias convention. #1676

Open PDoakORNL opened 5 years ago

PDoakORNL commented 5 years ago

I propose the following, which is compatible with our current coding conventions. Recall type should be the only entities with leading caps.

template<typename T>
class Derived : public A<T>
{
  using Base = A<T>;
  void myMethod(auto A) { Base::member_var = A; }
...
}

Multiple inheritance (MI) case, only necessary if there is ambiguity template class Derived : public A, B { using BaseA = A; using BaseB = B; ... }

ye-luo commented 5 years ago

I think for template base class, this is useful to avoid the long template base class name when accessing base class members. In the case of non template base class, I think this is optional right? Could you point somewhere in the source code as a real example?

PDoakORNL commented 5 years ago

You should not do this if you don't have a templated base class or MI ambiguity.

An example of what? Use the type naming convention well? We do well with classes.

PDoakORNL commented 5 years ago

Examples of type aliases for template base class in:

base_type