~ubuntu-branches/ubuntu/trusty/libc++/trusty

« back to all changes in this revision

Viewing changes to libcxx/test/containers/sequences/forwardlist/forwardlist.cons/move_alloc.pass.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-09-02 19:43:49 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20130902194349-top6vl3nq767uhdm
Tags: 1.0~svn189766-1
New snapshot release

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include "../../../test_allocator.h"
19
19
#include "../../../MoveOnly.h"
 
20
#include "../../../min_allocator.h"
20
21
 
21
22
int main()
22
23
{
51
52
        assert(!c0.empty());
52
53
        assert(c.get_allocator() == A(9));
53
54
    }
 
55
#if __cplusplus >= 201103L
 
56
    {
 
57
        typedef MoveOnly T;
 
58
        typedef min_allocator<int> A;
 
59
        typedef std::forward_list<T, A> C;
 
60
        T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 
61
        typedef std::move_iterator<T*> I;
 
62
        C c0(I(std::begin(t)), I(std::end(t)), A());
 
63
        C c(std::move(c0), A());
 
64
        unsigned n = 0;
 
65
        for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
 
66
            assert(*i == n);
 
67
        assert(n == std::end(t) - std::begin(t));
 
68
        assert(c0.empty());
 
69
        assert(c.get_allocator() == A());
 
70
    }
 
71
#endif
54
72
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
55
73
}