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

« back to all changes in this revision

Viewing changes to libcxx/test/containers/container.adaptors/priority.queue/priqueue.cons/ctor_comp_rcontainer.pass.cpp

  • Committer: Package Import Robot
  • Author(s): Andrej Belym
  • Date: 2012-06-02 19:25:47 UTC
  • Revision ID: package-import@ubuntu.com-20120602192547-b6ta950a8ckc9um2
Tags: upstream-1.0~svn160132
ImportĀ upstreamĀ versionĀ 1.0~svn160132

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===----------------------------------------------------------------------===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is dual licensed under the MIT and the University of Illinois Open
 
6
// Source Licenses. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
 
 
10
// <queue>
 
11
 
 
12
// explicit priority_queue(const Compare& comp, container_type&& c);
 
13
 
 
14
#include <queue>
 
15
#include <cassert>
 
16
 
 
17
#include "../../../MoveOnly.h"
 
18
 
 
19
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
20
 
 
21
template <class C>
 
22
C
 
23
make(int n)
 
24
{
 
25
    C c;
 
26
    for (int i = 0; i < n; ++i)
 
27
        c.push_back(MoveOnly(i));
 
28
    return c;
 
29
}
 
30
 
 
31
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
32
 
 
33
int main()
 
34
{
 
35
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
36
    std::priority_queue<MoveOnly> q(std::less<MoveOnly>(), make<std::vector<MoveOnly> >(5));
 
37
    assert(q.size() == 5);
 
38
    assert(q.top() == MoveOnly(4));
 
39
#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 
40
}