Return value adapter pattern

  • Authors:
  • Roger Doss

  • Affiliations:
  • Edison, NJ

  • Venue:
  • ACM SIGSOFT Software Engineering Notes
  • Year:
  • 2014

Quantified Score

Hi-index 0.00

Visualization

Abstract

This paper discusses a pattern that happens when the designer of a class is attempting to implement an array subscript operator in C++ using an adapter class for the return value. The return value adapter provides an interface to the caller that gives specialized access to the internal data of the referenced class. This approach allows the array subscript operator to transparently participate in a pipeline. An example is provided where the pattern is used to implement a 4 bit data type in C++.