Are std :: streams already movable?

GNU gcc 4.3 partially supports the following C ++ 0x standard: rvalue reference is used among the implemented functions. Using the rvalue reference, you can move an object that is not being copied or return it from a function.

Are std :: streams already movable via rvalue reference, or is something missing in the current library implementation?

+3
source share
2 answers

In current g ++ svn, rvalue link support has not yet been added to streams. I suspect that it will not be too complicated and, as always, open source, patches, I am sure, are welcome!

+2
source

, raleue reference ​​ .

, , :

struct noncopyable
{
    noncopyable()
    {}

    // move constructor
    noncopyable(noncopyable &&)
    {}

private:
    noncopyable(const noncopyable &);
    noncopyable &operator=(const noncopyable &);
};

, , , .

, :

noncopyable factory()
{
    noncopyable abc;
    return std::move(abc);
}

std:: stream , , STL, gcc 4.3.2, .

+1

Source: https://habr.com/ru/post/1699112/


All Articles