Skip to main content

Sorting Out the Relationships Between Pairs of Iterators, Values, and References

  • Conference paper
  • 904 Accesses

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 3676))

Abstract

Motivated by a wish to sort an array A while simultaneously permuting another array B, iteration over array pairs (A,B) is considered.

Traditional solutions to this problem require an adaption of either the algorithm or of the data structure. The generic programming approach described in this paper involves the construction of an iterator adaptor: an iterator pair. The different approaches are implemented in C++ and compared with respect to flexibility and performance.

Our design is also compared with another iterator-based design. When examining our solution, we identify the relationship between a reference type and a value type as an independent abstraction. We find that a valid “reference type” to a value type T is not necessarily T&. The reference pair developed in this paper serves as an example of a reference type which refers to a standard value pair without being a standard reference.

Our understanding of the relationships between iterator pairs, value pairs, and reference pairs, makes our design simpler than the alternative. It is argued that a recognition of these relationships is useful in many other generic programming contexts as well.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Comsol homepage, http://www.comsol.com/

  2. Boost MPL, homepage: http://www.boost.org/libs/mpl/doc/index.html

  3. Williams, A.: Pairing off iterators. Overload (2001), Avaliable at: http://web.onetel.com/~anthony_w/cplusplus/pair_iterators.pdf (2005-04-07)

  4. The C++ Standard, Incorporating Technical Corrigendum No. 1.2 edn. John Wiley & Sons, Ltd. (2003)

    Google Scholar 

  5. Abrahams, D., Siek, J., Witt, T.: New iterator concepts (2003), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1550.htm

  6. Musser, D., Saini, A.: STL Tutorial and Reference Guide. Addison-Wesley, Reading (1996)

    Google Scholar 

  7. C++ standard library active issues list, revision 35 (2005), http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html (2005-03-04)

  8. Alexandrescu, A.: Modern C++ Design: Generic Programming and Design Patterns Applied. Addison-Wesley, Reading (2001)

    Google Scholar 

  9. Musser, D.: Introspective sorting and selection algorithms. Software–Practice and Experience 8, 983–993 (1997)

    Article  Google Scholar 

  10. Abrahams, D., Gurtovoy, A.: C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and beyond. Addison-Wesley, Reading (2005)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Åhlander, K. (2005). Sorting Out the Relationships Between Pairs of Iterators, Values, and References. In: Glück, R., Lowry, M. (eds) Generative Programming and Component Engineering. GPCE 2005. Lecture Notes in Computer Science, vol 3676. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11561347_23

Download citation

  • DOI: https://doi.org/10.1007/11561347_23

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-29138-1

  • Online ISBN: 978-3-540-31977-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics