Skip to main content
Advice
0 votes
8 replies
381 views

I'm looking for a way to store type "dynamicly" in a using (or concret implementation) that would be modifable and accessible at compile-time. I would like something like: struct ...
DipStax's user avatar
  • 572
11 votes
4 answers
1k views

The program test tag dispatching pattern, where the function process_data(tag, a, b) can accept 2 tags int_tag, float_tag. There are 3 case: int_tag and a, b are int -> print a + b float_tag and a,...
Huy Le's user avatar
  • 2,009
1 vote
0 answers
98 views

I'm trying to construct a typed lambda calculus, something along the lines of: struct Fun<T>(T); // actual definition elided for simplicity struct TypeErasedExpr { /* elided for simplicity */ } ...
terepy's user avatar
  • 89
2 votes
1 answer
165 views

I have a class Foo from a third party library that has a lots of setters with a string argument named as set_parameter_name(std::string value). And I need to configure an instance of the class using a ...
Grigory's user avatar
  • 33
0 votes
1 answer
250 views

I’ve been experimenting in order to deepen my understanding of Python metaprogramming, and I have noticed a potentially useful behavior that I cannot find documentation to explain, so I don’t know ...
Steve Jorgensen's user avatar
-1 votes
1 answer
205 views

Here is code: aml::type_list<int,int,char,std::string> example; std::tuple_element_t<2,std::tuple<decltype(example)>> a = 'b'; But when i try to run code it says, static assertion ...
Hazret Hasanov's user avatar
-1 votes
1 answer
142 views

In c++ when i try to write a code that returns reverse of a type list what i wrote( a user defined template class): template <typename ...V,typename ...D> constexpr decltype(auto) merge(...
Hazret Hasanov's user avatar
4 votes
2 answers
541 views

Consider the following struct: struct Particle { float scale; float opacity; float rotation; }; I want the following to compile: static_assert(indexOf<&Particle::scale>() == 0); ...
Vittorio Romeo's user avatar
0 votes
1 answer
58 views

I want to parse and calculate formulas line by line. The formulas depend on the given variables x1 and x2. The number of formulas per line is not fixed, and there are dependencies between the results ...
HuaXian Tan's user avatar
0 votes
0 answers
22 views

I'm working with metaprogramming in Python and need to dynamically resolve functions. When a variable is directly assigned a function name, everything works. However, when assigned indirectly via ...
Shilin Wang's user avatar
2 votes
2 answers
242 views

I have this data class: @dataclass class User: id: str name: str pwd: str picture: str url: str age: int # many, many more attributes Now, I have to make all of the ...
Aadvik's user avatar
  • 1,522
4 votes
1 answer
76 views

I have the following: class A: def __init__(self, x): self.x = x A(5) # Works fine x = A.__new__ # Save the function A.__new__ = lambda y: y # Temporarily override it A.__new__ = x # ...
user9185231's user avatar
1 vote
0 answers
58 views

I have an in-memory table defined as follows in DolphinDB: t = table(2025.01.01 as date, 1 as M01, 2 as M02, 3 as M03, 4 as M04, 5 as M05, 6 as M06, 1 as M07, 2 as M08, 3 as M09, 4 as M10, 5 as M11, 6 ...
Shilin Wang's user avatar
8 votes
1 answer
199 views

I've created a type trait to create a type pack of rotating index sequences: #include <cstddef> #include <utility> template <class...> struct type_pack {}; template <size_t N>...
Ted Lyngmo's user avatar
  • 125k
7 votes
1 answer
226 views

I am trying to do some monkey patch work on an existing third-party library I am using. Summary This sequence does not work: Monkey patch A.__new__ using mynew Monkey patch A.__new__ again using ...
Gerges's user avatar
  • 6,679

15 30 50 per page
1
2 3 4 5
324