Skip to main content
2 votes
2 answers
115 views

Using C++26 reflection, the following works nicely: template<size_t from, size_t to, typename F> void compile_time_index_access(size_t index, F&& f) { template for(constexpr size_t i : ...
Amir Kirsh's user avatar
  • 14.6k
Advice
1 vote
3 replies
57 views

The question has moved to be a Q&A post following the comments: C++ reflection - compile time index access - but not with a macro
Amir Kirsh's user avatar
  • 14.6k
1 vote
1 answer
147 views

I am experimenting with the new annotation freshly added in C++26, specifically looking at the examples provided in the proposal paper. The paper contains the following example using a hypothetical ...
Desmond Gold's user avatar
  • 2,300
Tooling
0 votes
3 replies
70 views

I want to deep copy specific fields from one class to another. However, I don't want to copy everything. Is there a tool for this or another method I could use? The class is in a library, so I can't ...
Big's user avatar
  • 155
1 vote
2 answers
64 views

I'm trying to load a type from an assembly at runtime that implements this interface which is in a project called PluginBase: type IPlugin = abstract member TestString: Option<string> with ...
JackEncore's user avatar
2 votes
1 answer
135 views

Suppose I get a pointer, and I want to determine whether it's "CUDA-associated", i.e. allocated by CUDA as pinned host-side memory, device-side memory, managed memory, array memory, etc. - ...
einpoklum's user avatar
  • 138k
2 votes
0 answers
111 views

I recently discovered MethodRental and it seems really interesting, coming from JS, being able to pre-empt existing functions can be a neat hacky get-out-of-jail card for the toolbelt. As an aside, ...
Hashbrown's user avatar
  • 13.3k
Tooling
0 votes
4 replies
78 views

I want to compile github branch https://github.com/bloomberg/clang-p2996 (forked off of llvm/llvm-project) to try out some of the experimental reflection features. Following https://llvm.org/docs/...
Johan Röjas Söderman's user avatar
Best practices
0 votes
2 replies
73 views

I'm using Quarkus enabling native compilation. At runtime I noticed some exceptions that required me to register classes for reflection e.g: @RegisterForReflection( targets = { MyClass.class, ...
dev4fun's user avatar
Best practices
0 votes
2 replies
57 views

Suppose that I have two classes that differ only in terms of their @Value "values" on their fields. For example: @Component public class BlueWidget { @Value("${blue.message}") ...
Gus Murphy's user avatar
-1 votes
2 answers
109 views

public void Test<T>(T reference, T same, T differentOrGreater) { var comparisonInterface = typeof(T) .GetInterfaces() .FirstOrDefault( i => i.IsGenericType &...
codymanix's user avatar
  • 29.7k
2 votes
1 answer
110 views

I can format an Int32, I1, as currency - it displays: I1 = $31,742. But I cannot format an Int32 property of a class whose PropertyInfo and whose value and whose format is determined by reflection. ...
BandannaMan's user avatar
1 vote
1 answer
110 views

public interface A<out T> { public T Property { get; } } public class BaseClass : A<string>, A<int> { string A<string>.Property => "BaseClass"; int A&...
popsicle7500's user avatar
11 votes
1 answer
1k views

With C++26 reflection, we can simply iterate all data members of an object: #include <iostream> #include <meta> struct Foo { int x; int y; }; void PrintFoo(const Foo& foo) { ...
Timothy Liu's user avatar
Advice
0 votes
5 replies
127 views

With the new C# 14 feature of static extension methods and extension properties, how to find and use them via reflection? (From the docs) public static class MyExtensions { extension(string str) ...
Jens's user avatar
  • 25.7k

15 30 50 per page
1
2 3 4 5
1689