Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22055

Compile time complexity (i.e run time complexity of the compiler) of std::tuple_element

$
0
0

Suppose in my code I have the line:

using T = std::tuple_element<N,TupleType>

where TupleType is the type of a very large tuple and N is a very large number (think like 1,000,000)

I understand that this line of code has no impact of the runtime perfromance of my program. But what kind of impact does it have on how long it takes for my program to compile (i.e how does this impact the runtime of the compiler)

Basically is the compiler going to solve this in O(N)? O(log(N))? O(1)?

As I see it a naive implementation using standard C++ would be O(N). A smarter implementation using standard C++ would be O(log(N)). And if the compiler does something special under the hood it can achieve O(1). Which of these is true for GNU GCC compiler?

NOTE: I need to handle processing a lot of types for a template metaprogramming task. I never actually instantiate an instance of this tuple type. Just using it as a container for types at compile time.


Viewing all articles
Browse latest Browse all 22055

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>