hanchenye-llvm-project/libcxx/test/containers/associative/map/map.cons/alloc.pass.cpp

43 lines
1.0 KiB
C++
Raw Normal View History

2010-05-12 03:42:16 +08:00
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
2010-05-12 03:42:16 +08:00
//
2010-11-17 06:09:02 +08:00
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
2010-05-12 03:42:16 +08:00
//
//===----------------------------------------------------------------------===//
// <map>
// class map
// explicit map(const allocator_type& a);
#include <map>
#include <cassert>
#include "test_allocator.h"
#include "min_allocator.h"
2010-05-12 03:42:16 +08:00
int main()
{
{
2010-05-12 03:42:16 +08:00
typedef std::less<int> C;
typedef test_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(A(5));
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A(5));
}
#if __cplusplus >= 201103L
{
typedef std::less<int> C;
typedef min_allocator<std::pair<const int, double> > A;
std::map<int, double, C, A> m(A{});
assert(m.empty());
assert(m.begin() == m.end());
assert(m.get_allocator() == A());
}
#endif
2010-05-12 03:42:16 +08:00
}