mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
75545ff70d
To avoid using data belonging to a temporary, the parse functions are ref qualified to get a compile error if used on an rvalue. See https://github.com/simdjson/simdjson/issues/696 Compilation tests are also added, to make sure bad usage fails to compile. Reviewed by jkeiser.
21 lines
485 B
C++
21 lines
485 B
C++
//example for a compile test
|
|
|
|
// keep as much code as possible outside of the conditional compilation
|
|
// so the thing that is to proven to not compile fails to compile because
|
|
// some unrelated thing (like forgetting to include a header)
|
|
|
|
#include <vector>
|
|
|
|
int main() {
|
|
|
|
#if COMPILATION_TEST_USE_FAILING_CODE
|
|
// code that is supposed to fail compiling (keep it short!)
|
|
xxx
|
|
#else
|
|
// equivalent code that is supposed to compile (keep it short!)
|
|
#endif
|
|
|
|
// common code
|
|
|
|
}
|