Am I the only one who finds std :: move too hard to understand?

So, I was reading about std::move, std::forward, rvalues, lvalues of ad and so on SO and elsewhere. But I find that I can’t understand. Despite the fact that I sometimes get into corrections, I think that I understand the basic things about pointers, links, etc. that were in C ++ before that. Is it me or are these things getting too heavy?

+5
source share
2 answers

Your question is very general. Maybe I can start:

  • Ignore function std:move()and std::forward()at the beginning of
  • One aspect of RValue References is the preservation of time series.
    • ++ 03 temps Matrix z = a + b + c + d; ( Matrix a,b,c,d;)
    • operator+ Matrix RValue.
    • .

std::move(): :

  • , Image - .
  • -
  • factory, :

    Image load_matching_size(const char *fn_small, const char *fn_big) {
       pair<Image> ii = load_2_images(fn_small, fn_big);
       return ii.first.width() >= 64 ? ii.first : ii.second;
    }
    
  • ? , return ! ( , ( "RVO" ) )

  • , ? ii . ? (, . RVO , Image).
  • move return , ii . , , , move-c'tor copy-c'tor .
+1

, :

++

, rvalue , , rvalue .

, . rvalue , ++ 0x ( , ), , , .

+7

All Articles