CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  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 02: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
  •  





Click Here to Expand Forum to Full Width

Featured