在调试NULL Ref Exception期间,我意外取消选中了异常popUp中的框#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
template<typename T>
std::vector< std::vector<T> > split(std::vector<T> vec, uint64_t n) {
std::vector< std::vector<T> > vec_of_vecs(n);
uint64_t quotient = vec.size() / n;
uint64_t reminder = vec.size() % n;
uint64_t first = 0;
uint64_t last;
for (uint64_t i = 0; i < n; ++i) {
if (i < reminder) {
last = first + quotient + 1;
vec_of_vecs[i] = std::vector<T>(vec.begin() + first, vec.begin() + last);
first = last;
}
else if (i != n - 1) {
last = first + quotient;
vec_of_vecs[i] = std::vector<T>(vec.begin() + first, vec.begin() + last);
first = last;
}
else
vec_of_vecs[i] = std::vector<T>(vec.begin() + first, vec.end());
}
return vec_of_vecs;
}
#define ONE_DIMENSION 11
#define SPLITS 3
int main(void)
{
std::vector<uint64_t> vector(ONE_DIMENSION);
std::iota(std::begin(vector), std::end(vector), 1);
std::vector<std::vector<uint64_t>> vecs(SPLITS);
vecs = split(vector, SPLITS);
for (uint64_t m = 0; m < vecs.size(); ++m) {
for (auto i : vecs[m])
std::cout << std::setw(3) << i << " ";
std::cout << std::endl;
}
return 0;
}
。我该如何重新开启?
我看过debug-&gt;例外,但没有看到null ref
答案 0 :(得分:3)
在IDE中,按 CTRL + ALT + E 。
使用出现的窗口右上角的搜索栏,搜索
NullReferenceException
你会看到:
或者,您可以尝试“恢复默认值”:
如果您在测试管理正确的异常时遇到问题,请尝试抛出异常并与复选框(关闭和打开)进行交互,如下所示。如果开启,那么break
此处,如果关闭,则不要break
: