C++ style guide

Skip to first unread message

Александр Иванов

Jan 9, 2023, 9:05:53 AMJan 9
to Ceres Solver
While working with ceres I have observed some code style inconsistences.

* Simple "grep"ing shows quite extensive usage of "using"s for std::some_type: using std::some_type; ... some_type<T> v;.  I wonder if it makes sense since in the most cases more ordinary std::some_type is used. Even within the same file sometimes I see both vector<int> and std::vector<int>. I think it is quite misleading and it would be better to stick to explicit std:: throughout the project (explicit is better than implicit)

Some files where these "usings"s are found (it is a short list, there are many more of them):
internal/ceres/visibility_test.cc:45:using std::set;
internal/ceres/visibility_test.cc:46:using std::vector;
internal/ceres/cost_function_to_functor_test.cc:43:using std::vector;
internal/ceres/low_rank_inverse_hessian.cc:40:using std::list;
internal/ceres/residual_block_test.cc:43:using std::vector;

* I observe typedefs for defining type aliases. It seems to me that they should be replaced with more clear "using A = B" statements

If there are no objections I can fix both these issues since I am right now can spent some time moving changes from my local ceres repo to the main one

Sameer Agarwal

Jan 9, 2023, 9:07:57 AMJan 9
to ceres-...@googlegroups.com
These are mostly historical artifacts from earlier versions of the code inside google. as for typedefs they are basically a c++98 artifact which have not been updated. I am happy to accept a change that fixes both of these.

Thank you,

You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/f7f684b2-0d3d-4070-b73a-234de739928dn%40googlegroups.com.
Reply all
Reply to author
0 new messages