Tag: c#
-
Inconsistent behavior of std::common_reference_with on tuples. Which is correct?
11 Background: I’m trying to port a library to compile on MSVC. That library stores data in a tuple of vectors (std::tuple<std::vector<Ts>…>), and uses a custom iterator to iterate over all vectors simultaneously (similar to what a zip_iterator does). The iterator defines types that look like this (assuming Ts… -> <int, int>) : `value_type` is…
-
Only bitwise operations for std::byte in C++17?
12 In CPP Reference it is stated that: std::byte is a distinct type that implements the concept of byte as specified in the C++ language definition. Like char and unsigned char, it can be used to access raw memory occupied by other objects (object representation), but unlike those types, it is not a character type…
-
.Net Lead – Amzur Technologies, Inc. – Remote
Amzur Technologies, Inc. Remote Depends on Experience Contract: W2, Corp-To-Corp, 6 Month(s) Skills ReactJS GraphQL C# REST API .Net Core Job Description Summary/ ResponsibilitiesThe Software Engineering Manager Chapter Lead guides technology adoption across product teams, builds, and maximizes the capabilities and skills within the chapter, manages and supports chapter members (employees and contingent labor). The…
-
How do the std::left and std::right I/O manipulators work, and why are they used in the way they are used?
7 I am learning C++ and my goal is to have a table beautifully displayed in console. I tried using std::left and std::right I/O manipulators, but now that I look at my code I cannot figure out what exactly these things are and what kind of mechanism they employ. So far, every function call required…
-
Does nullptr_t break type punning or pointer conversions?
7 Consider this union: typedef union { void* vptr; nullptr_t nptr; } pun_intended; nullptr_t is supposedly compatible with void*. Ok so what if we initialize the void* to some non-zero value? pun_intended foo = { .vptr = (void*)42 }; This conversion is supposedly legit (impl.defined) as per C23 6.3.2.3 §4, or at least it was…
-
Why does the derived class have access to the private field of the base class?
10 class Base { public: class FirstBase { friend class Base; int x = 10; }; class SecondBase : public FirstBase { public: SecondBase() : FirstBase() {} void t() { std::cout << FirstBase::x; } }; }; This code compiles and works, but I don’t understand why it works. Can explain or cite sources to read?…
-
Is clang generating incorrect code for inline assembly?
9 I have some C code: #include "stdio.h" typedef struct num { unsigned long long x; } num; int main(int argc, char **argv) { struct num anum; anum.x = 0; __asm__("movq %%rax, %0n" : "=m" (anum.x) : "rax"(2)); printf("%llun",anum.x); } which I’m compiling and running on my (intel) Mac laptop. The output from the code…
-
What is ({}) called in C++?
11 I just read code like this: auto value = ({ auto it = container.find(key); it != container.end() ? it->second : default_value; }); What is this ({}) called? I don’t think I’ve ever seen this before. c++ Share Improve this question Follow edited yesterday Hesky Fisher asked yesterday Hesky FisherHesky Fisher 1,02777 silver badges1111 bronze…
-
Cannot access to a disposed context instance
0 I’m using dotnet 6 with GraphQL 7. I’m having some issues only in one Field. The error appears only when the app is deployed in the cluster (kubernetes), but never in local. So it seems like the Dependency Injection is not working properly, here is the code of the query: public class UserModulesProgressField :…
-
What’s the meaning of &T::operator() in function traits?
6 // Fallback, anything with an operator() template <typename T> struct function_traits : public function_traits<decltype(&T::operator())> > { }; What does T::operator() mean here? This is code from pytorch. c++ function-object Share Improve this question Follow edited 14 hours ago Jan Schultke 14k44 gold badges4242 silver badges8383 bronze badges asked 18 hours ago ben19900305ben19900305 6333 bronze…