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 // <vector> 11 // vector<bool> 12 13 // std::find with vector<bool>::iterator 14 15 // https://bugs.llvm.org/show_bug.cgi?id=16816 16 17 #include <vector> 18 #include <algorithm> 19 #include <cassert> 20 #include <cstddef> 21 main()22int main() 23 { 24 { 25 for (unsigned i = 1; i < 256; ++i) 26 { 27 std::vector<bool> b(i,true); 28 std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false); 29 assert(static_cast<std::size_t>(j-b.begin()) == i); 30 assert(b.end() == j); 31 } 32 } 33 { 34 for (unsigned i = 1; i < 256; ++i) 35 { 36 std::vector<bool> b(i,false); 37 std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true); 38 assert(static_cast<std::size_t>(j-b.begin()) == i); 39 assert(b.end() == j); 40 } 41 } 42 } 43