1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// uses_allocator example
#include <iostream>
#include <memory>
#include <vector>
int main() {
typedef std::vector<int> Container;
typedef std::allocator<int> Allocator;
if (std::uses_allocator<Container,Allocator>::value) {
Allocator alloc;
Container foo (5,10,alloc);
for (auto x:foo) std::cout << x << ' ';
}
std::cout << '\n';
return 0;
}
|