Jump to content
Sign in to follow this  
tudor.timi

Redundant C++ declarations of same API

Recommended Posts

A lot of C++ snippets contain redundant declarations of the same interfaces, for example arithmetic ops. Here's an example:

template <>
class rand_attr<bit> : public detail::RandAttrBitBase {
  // ...
  
  detail::ExecStmt operator= (const detail::AlgebExpr& value);
  detail::ExecStmt operator+= (const detail::AlgebExpr& value);
  detail::ExecStmt operator-= (const detail::AlgebExpr& value);
  detail::ExecStmt operator<<= (const detail::AlgebExpr& value);
  detail::ExecStmt operator>>= (const detail::AlgebExpr& value);
  detail::ExecStmt operator&= (const detail::AlgebExpr& value);
  detail::ExecStmt operator|= (const detail::AlgebExpr& value);
}

Does a reader really need to see these declarations? Does the user even need to know that there is a rand_attr specialization for bit.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×