Summary: Access to std::vector shouldn't be treated as SKIP. Implementation is simple enough to use one from std:: headers Reviewed By: jvillard Differential Revision: D4339577 fbshipit-source-id: d1fbbeemaster
parent
acdc081100
commit
96ba74d18e
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace iterator_access {
|
||||||
|
struct X {
|
||||||
|
int id;
|
||||||
|
};
|
||||||
|
|
||||||
|
int possible_npe(std::vector<X> in) {
|
||||||
|
int* x = nullptr;
|
||||||
|
for (auto iter = in.begin(); iter != in.end(); ++iter) {
|
||||||
|
if (iter->id >= 0 && iter->id <= 0) {
|
||||||
|
return *x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int impossible_npe(std::vector<X> in) {
|
||||||
|
int* x = nullptr;
|
||||||
|
for (auto iter = in.begin(); iter != in.end(); ++iter) {
|
||||||
|
if (iter->id > 0 && iter->id <= 0) {
|
||||||
|
return *x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue