Named Arguments and Method Chaining

In this chapter, we are going to examine a solution to a very common C++ problem, too many arguments. No, we are not talking about the arguments between C++ programmers, such as whether to put curly braces at the end of the line or at the start of the next one (we have no solution to that problem). This is the problem of C++ functions with too many arguments. If you have maintained a large C++ system long enough, you have seen it—functions start with simple declarations and, over time, grow additional arguments, often defaulted, to support new features.

The following topics will be covered in this chapter:

  • What are the problems with long function declarations?
  • What is the alternative?
  • What are the downsides of using the named arguments idiom?
  • How can the named arguments idiom be generalized?
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.251.3