+ 1

How to verify that templated code is copy pasted with type

Hi I have a template function. I just need to verify what compiler generates (both functions with called type) in some intermediate output files of compile process. How to verify this ?

30th Jan 2025, 3:29 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Respuestas
+ 2
Ketan Lalcheta Try checking these posts on Stackoverflow. Sounds like you may want some combination of type_traits and/or concepts 👉 std::invocable 👉 std::is_invocable<Callable, Args...> 👉 std::is_convertible<std::function<Signature>, ...> 👉 std::is_same or std::enable_if with decltype() or declvalue() https://stackoverflow.com/questions/47698552/how-to-check-if-template-argument-is-a-callable-with-a-given-signature/ https://stackoverflow.com/questions/38067106/c-verify-callable-signature-of-template-type https://stackoverflow.com/questions/43585606/detect-if-class-has-constructor-with-signature
30th Jan 2025, 6:42 PM
Shardis Wolfe
0
Nope Shardis Wolfe I was not looking for this. Let me describe what I am looking for. I have a template function as below: template <typename T> void display(T arg) { cout << arg << endl; } Now , I want to verify( by looking into some generated file by compilers ) that 1. This function is not available until display is not called 2. This function with T as int is available only if display(1) is called. 3. This function with T as double is available only if display(1.2) is called. Is there an option to verify the intermediate files which compiler generates ?
1st Feb 2025, 7:51 PM
Ketan Lalcheta
Ketan Lalcheta - avatar