File: supported_implementations.h

package info (click to toggle)
simdjson 4.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,936 kB
  • sloc: cpp: 171,612; ansic: 19,122; sh: 1,126; python: 842; makefile: 47; ruby: 25; javascript: 13
file content (30 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include "simdjson.h"
#include <vector>
#include <cstdlib>

/**
 * @brief get_runtime_supported_implementations
 * Returns a vector of implementations, which both
 * have been compiled *and* are dynamically checked to
 * be supported at runtime.
 *
 * Aborts if no implementations are available (should not happen, fallback
 * should always be there for us!)
 * @return
 */
std::vector<const simdjson::implementation*>
get_runtime_supported_implementations() {
    std::vector<const simdjson::implementation*> ret;
    for(auto& e: simdjson::get_available_implementations()) {
        if(e->supported_by_runtime_system()) {
            ret.emplace_back(e);
        }
    }
    if(ret.empty()) {
        // No implementations available, not even fallback, weird.
        std::abort();
    }
    return ret;
}