1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <vector> 10 // vector<bool> 11 12 // std::find with vector<bool>::iterator 13 14 // https://bugs.llvm.org/show_bug.cgi?id=16816 15 16 #include <vector> 17 #include <algorithm> 18 #include <cassert> 19 #include <cstddef> 20 21 int main(int, char**) 22 { 23 { 24 for (unsigned i = 1; i < 256; ++i) 25 { 26 std::vector<bool> b(i,true); 27 std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false); 28 assert(static_cast<std::size_t>(j-b.begin()) == i); 29 assert(b.end() == j); 30 } 31 } 32 { 33 for (unsigned i = 1; i < 256; ++i) 34 { 35 std::vector<bool> b(i,false); 36 std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true); 37 assert(static_cast<std::size_t>(j-b.begin()) == i); 38 assert(b.end() == j); 39 } 40 } 41 42 return 0; 43 } 44