stdmove Questions
2
Solved
Look at this code:
class Foo
{
public:
string name;
Foo(string n) : name{n}
{
cout << "CTOR (" << name << ")" << endl;
}
Foo(Foo&& moved)
{
cout <<...
Carri asked 2/6, 2016 at 14:17
3
Solved
I have heard Scott Meyers say "std::move() doesn't move anything" ... but I haven't understood what it means.
So to specify my question consider the following:
class Box { /* things... */ };
Box...
Clicker asked 24/4, 2016 at 19:31
4
Solved
I have a function which modifies std::string& lvalue references in-place, returning a reference to the input parameter:
std::string& transform(std::string& input)
{
// transform the i...
Heikeheil asked 7/5, 2015 at 7:2
2
Solved
This answer explains how to move-capture a variable within a lambda in C++14.
But once you've move-captured an un-copyable object (such as a std::unique_ptr) within a lambda, you cannot copy...
Lattimer asked 9/9, 2015 at 18:17
3
Solved
I always read that std::forward is only for use with template parameters. However, I was asking myself why. See the following example:
void ImageView::setImage(const Image& image){
_ima...
Matador asked 3/3, 2015 at 9:24
3
Solved
Consider a type T supporting the default move semantics. Also consider the function below:
T f() {
T t;
return t;
}
T o = f();
In the old C++03, some non-optimal compilers might call the copy...
Tallia asked 5/8, 2012 at 16:0
2
Solved
I don't fully understand the implementation of std::move().
Namely, I am confused by this implementation in the MSVC standard library:
template<class _Ty> inline
typename tr1::_Remove_refere...
Cacilie asked 22/9, 2011 at 6:0
2
Solved
I don't understand very well the std::move function
template <class T>
typename remove_reference<T>::type&&
move(T&& a)
{
return a;
}
why remove_reference ?
co...
Quadrifid asked 3/4, 2011 at 11:45
© 2022 - 2024 — McMap. All rights reserved.