Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 745113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:03:26+00:00 2026-05-14T09:03:26+00:00

In my adventures studying the boost libraries, I’ve come across function signatures that have

  • 0

In my adventures studying the boost libraries, I’ve come across function signatures that have parameters which are a reference to a reference to an object.

Example:

void function(int && i);

What is the purpose/benefit of doing it this way rather than simply taking a reference to an object? I assume there is one if it’s in boost.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T09:03:27+00:00Added an answer on May 14, 2026 at 9:03 am

    This is not a reference to a reference; there is no such thing.

    What you’re seeing is a C++0x rvalue reference, denoted by double ampersands, &&. It means that the argument i to the function is a temporary, so the function is allowed to clobber its data without causing problems in the calling code.

    Example:

    void function(int &i);  // A
    void function(int &&i); // B
    int foo();
    
    int main() {
        int x = foo();
        function(x);     // calls A
        function(foo()); // calls B, because the return value is a temporary
    }
    

    This rarely useful with plain ints, but very useful when defining move constructors, for example. A move constructor is like a copy constructor, except that it can safely ‘steal’ the internal data from the original object, because it’s a temporary that will cease to exist after the move constructor returns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My adventures in Java have lead me to look into Clojure, which then lead
Since I started studying object-oriented programming, I frequently read articles/blogs saying functions are better,
I'm trying to work my way through Ron Jeffries's Extreme Programming Adventures in C#.
Summary Hi All, OK, further into my adventures with custom controls... In summary, here
My adventures in Python continue and my favorite books are silent again. Python offers
My adventures with entity groups continue after a slightly embarrassing beginning (see Under some
So far in my .Net coding adventures I've only had a need to save
At some point during my C programming adventures on Linux, I encountered flags (possibly
This has been an adventure. I started with the looping duplicate query located in
I'm starting my adventure with Ruby on Rails and as IDE I choose Netbeans.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.