C++ Memory Management: What is the purpose of a constant reference?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: C++ Memory Management: What is the purpose of a constant reference?

Threaded View

  1. #1
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    C++ Memory Manament: What is the purpose of a constant reference?

    Q: What is the purpose of a constant reference?

    A: Passing by a constant reference avoids creating a temporary object (thus copying) and thus can vastly improve performance.

    However passing constant references to the standard data types (char, int, long, double, ...) does not result in any performance gain. Usually, these types are passed by value instead.


    FAQ contributed by: [Kevin Hall]


    Last edited by Andreas Masur; July 23rd, 2005 at 03:10 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center