-
-
Notifications
You must be signed in to change notification settings - Fork 379
Coding Style and Idioms
For container indexes, use:
-
size_tforstd::vector<S>, -
intforEigen::Matrix<S, R, C>, and -
T::size_typefor template paramsTthat might be instantiated as either astd::vector<S>orEigen::Matrix<S, R, C>.
One could argue we should always use Eigen::Matrix<S, R, C>::size_type for Eigen constructs just in case we ever decide that we want to change their default indexing from int to something else. But int should be OK for now because if we change the index type for some reason, the compiler will let us find instances.
Use two spaces for indentation. There are emacs modes to enforce this.
Whenever possible, keep lines to 80 characters or less. It makes it much easier to review pull requests, view diffs, etc.
For both template parameter lists and template argument lists, use spaces between parameters and arguments. As above for template argument lists:
Eigen::Matrix<S, R, C>::size_type
and for template parameter lists:
template<typename T1, typename T2>
struct foo {
...
};