/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include void insert_impure(std::vector& vec) { vec.insert(vec.begin(), 2); } void push_back_impure(std::vector& vec) { vec.push_back(32); } void fresh_push_back_pure() { std::vector vec = {0, 0}; push_back_impure(vec); } // modifies vec void push_back_in_loop_impure(std::vector& vec, std::vector& vec_other) { for (const auto& i : vec_other) { vec.push_back(i); } } // modifies vec void clear_impure(std::vector& vec) { vec.clear(); } // modifies vec void assign_impure(std::vector& vec) { vec.assign(11, 7); } struct A { int i; }; // iterators are not modeled in pulse yet int set_zero_impure_FN(std::vector& numbers) { for (auto& num : numbers) { num.i = 0; } return 0; }