Tag: arrays
-
Discrepance between an array response from graphQL and same array printed with a console log
0 I have a very strange behaviour and I need your help. I retrieve a list of content from a GraphQl API that i attach you: client.query({query: PAGES_LIST}).then(res => console.log(res.data.pages) The problem is that the response from the network is that: [ { "id": "ddf", "title": "DDF", "type": "HOME", "draft": false, "newtonId": "64edfc8f3508bb20a9dbef19", "creationDate": "2023-08-29…
-
GCC removes a bounds check in the right operand of &&, but not in the left operand, why?
18 I have the following C/C++ code snippet: #define ARRAY_LENGTH 666 int g_sum = 0; extern int *g_ptrArray[ ARRAY_LENGTH ]; void test() { unsigned int idx = 0; // either enable or disable the check "idx < ARRAY_LENGTH" in the while loop while( g_ptrArray[ idx ] != nullptr /* && idx < ARRAY_LENGTH */ )…
-
GraphQL uses REST query which has an array as JSON response does not work
0 I’m trying to query another system with a GraphQL query. Due to the system only takes REST queries I use the @rest operator to convert the query. But the REST query has an array as response which leads to the following error: {"name":"ApolloError","graphQLErrors":[],"clientErrors":[],"networkError":{},"message":"typename is undefined"} GraphQL query: const QueueStatusQuery = gql` query checkQueueStatus_HLS{ robot(input:{})…
-
Execute a graphql query using painless script, with params having hyphen and space and match a field property with type keyword and text
0 I’m new to graphql and opensearch queries. Here I’m trying to add a filter to existing query for city, my params inside the query are having data with – and spaces. While I’m trying to query it, data is getting filtered only with first word. For example, my params is having an array "cityNames"…
-
Convenient way to declare 2D (or even higher dimension) arrays with std::array
26 I’m about to convert a lot of old C++ code to more modern C++. There are many raw 2D arrays in that code like: Foo bar[XSIZE][YSIZE]; And I’m about to replace these declarations with std::array<std::array<Foo, YSIZE>, XSIZE> bar; This is a convenient way because the statements stay the same and the code is supposed…
-
In C++ Inheritance, Derived class destructor not called when pointer object to base class is pointed to array of derived class
17 I have an Animal class with constructor and destructor. Cat have a private Brain* attribute. Upon construction, Cat creates his Brain using new Brain(); Upon destruction, Cat deletes his Brain. I don’t understand why The cat’s and brain’s destructors not called, when my Base class destructor is virtual? #include <iostream> using std::cout ; using…
-
Is gcc wrong to allow the initialization of a const array member with another array reference?
8 While (re)implementing a simple constexpr map, I wrote this (godbolt): template <class key_type, class value_type, int N> class flat_map { private: struct pair { key_type key; value_type value; }; const pair elements[N]; public: consteval flat_map(const pair (&arr)[N]) noexcept : elements(arr) // works on gcc?! {} [[nodiscard]] consteval value_type operator[](const key_type key) const { for…
-
Why is b.pop(0) over 200 times slower than del b[0] for bytearray?
24 Letting them compete three times (a million pops/dels each time): from timeit import timeit for _ in range(3): t1 = timeit(‘b.pop(0)’, ‘b = bytearray(1000000)’) t2 = timeit(‘del b[0]’, ‘b = bytearray(1000000)’) print(t1 / t2) Time ratios (Try it online!): 274.6037053753368 219.38099365582403 252.08691226683823 Why is pop that much slower at doing the same thing? python…