42 typedef std::deque<Value, std::allocator<Value> >
Deque;
43 typedef std::char_traits<char>
Traits;
44 typedef std::ostream_iterator<Value, char, Traits>
Iterator;
46 const Value arr[] = { 0, 1, 2, 2, 3, 4, 2, 2, 6, 7 };
49 Deque d (arr + 0, arr +
sizeof arr /
sizeof *arr);
50 std::sort (
d.begin (),
d.end ());
53 const Value val_1 = 3;
54 const Value val_2 = 11;
57 const bool found_1 = std::binary_search (
d.begin (),
d.end (), val_1);
58 const bool found_2 = std::binary_search (
d.begin (),
d.end (), val_2,
62 std::cout <<
"Container contents: ";
63 std::copy (
d.begin (),
d.end (),
Iterator (std::cout,
" "));
66 std::cout <<
"\nThe number " << val_1 <<
" was "
67 << (found_1 ?
"" :
"NOT ") <<
"found";
69 std::cout <<
"\nThe number " << val_2 <<
" was "
70 << (found_2 ?
"" :
"NOT ") <<
"found\n";
std::deque< std::string, std::allocator< std::string > > Deque