Skip to main content

Questions tagged [metaprogramming]

Metaprogramming is the capability to reprogram ones programming environment, as with macros or metaclasses.

metaprogramming
0 votes
0 answers
22 views

Making a tuple of references out of another tuple by condition

I have a templated structure ContainerInner that has a tuple with vectors of types from its variadic template and a structure Container that contains a tuple of ContainerInner, specified in its ...
SavedowW's user avatar
0 votes
2 answers
62 views

Is it possible to use a modified version of a class template parameter pack in a members template?

I am trying to write a class template with a variadic template parameter pack which is separated into two groups of arguments. Those shall be used in member templates. template <class... Args> ...
DominikRzecki's user avatar
0 votes
1 answer
133 views

How can I check if a certain function overload is invalid?

I am making a type erased class TypeErased using std::variant, that could be an integer, a complex number, a vector, or an error. While I am making the addition operator (which uses std::visit), I ...
hello there's user avatar
0 votes
3 answers
95 views

Can we call the respective original function with parameters automatically from proxy class in C++?

I have a class and a proxy class which holds pointer to original class to call its functions in C++. I am using proxy class for logging purpose . From each function of proxy class , In addition to ...
suresh kumar's user avatar
0 votes
0 answers
49 views

Best Practice for updating class attribute based on values

I have to read set of csv files which have 5 columns like name, age, address, type and distance. As these column names are string and I want to iterate them in my pandas df. I have created a class ...
abby37's user avatar
  • 647
0 votes
1 answer
21 views

How to Configure and Use My Existing WhatsApp Business Number with Twilio API?

I have successfully created a webhook and configured it to handle incoming messages and send responses using Twilio's API. However, I'm currently using a Twilio-provided WhatsApp Business number. I ...
Cherridev cherritech's user avatar
-1 votes
1 answer
57 views

Need help designing a constexpr lookup [closed]

I am developing a library to run pipelines defined at compile time. This is done for some stricter compile-time checks and works fairly well in the scenarios tried so far. Now I want to add a new kind ...
Eugene's user avatar
  • 9,392
0 votes
0 answers
43 views

What is the preferred / recommended rlang metaprogramming syntax to use on both sides of an assignment operator in the `dplyr::mutate()` function?

I have a question about an issue that's similar to this older question about the dplyr::filter() function, except that my example is a bit more complicated because dplyr::mutate() needs to process ...
stachyra's user avatar
  • 4,553
-1 votes
2 answers
104 views

C++ extraneous 'template<>' in declaration of variable 'val'

I'm trying meta-programming so that factorial can be computed in compile-time. Here is the 1st version: template <int N> struct Fac { static const int val = N * Fac<N - 1>::val; }; ...
Ethan's user avatar
  • 125
0 votes
1 answer
73 views

How to dynamically create type annotations in Python?

Normally, one can define a class with some type-annotated fields as follows: class A: a: str How to do this dynamically using type function? I know the case when a is assigned to a value, i.e., ...
Clément Dato's user avatar
4 votes
1 answer
58 views

Behavior of object.__new__ Python dunder. What is happening under the hood?

I'm experimenting with metaprogramming in Python (CPython 3.10.13) and noticed some weird behavior with object.__new__ (well, weird to me, at least). Take a look at the following experiment (not ...
Cornélio Sousa's user avatar
2 votes
1 answer
37 views

Wrapped functions of a Python module raise TypeError

I am currently trying to replace a module in a large code base in a certain condition and to figure out when any function of this module is called, I wrap each function/method in the module with a ...
Green绿色's user avatar
  • 2,335
0 votes
1 answer
97 views

How to use a non-template function to achieve perfect forwarding by an argument-wise manner?

template<typename T> class Group; template<typename...U> class Group<std::tuple<U...>> { public: typedef std::tuple<U...> type; void emplace_back(U&......
soyokaze's user avatar
0 votes
2 answers
98 views

Getting object member at compile time

I'd like to make a compile-time map in which I'll connect a number to a member of a class. Then return member of a class from a function at compile-time. This is the current code class MyClass { ...
NormakLOE32's user avatar
0 votes
1 answer
40 views

How to create functions with Metaprogramming that have Struct Pattern Matching?

I am trying to create two functions :red_pieces and :black_pieces inside the module Board meant to get an element from the struct. I want the compiled function to pattern match on %Board to it would ...
Maximilian Ballard's user avatar

15 30 50 per page
1
2 3 4 5
321