Last active
February 24, 2020 13:55
-
-
Save juliusHuelsmann/4652c78915ba48766484fdcc41737b08 to your computer and use it in GitHub Desktop.
Partial template specialization: This snipplet shows how it is possible to work with the underyling types of a std::tuple.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Julius Hülsmann | |
// Email: juliusHuelsmann [at] gmail.com, julius.huelsmann [at] data-spree.com | |
// Creation Date: 2020-02-18 | |
// Execution: g++-10.0 -std=c++2a untuple.cc | |
// This snipplet shows how it is possible to work with the underyling types of a std::tuple and | |
// shows a principle that can be used e.g. in oder to work with an index_sequence. | |
#include <tuple> | |
template <typename tpl> struct untuple; | |
template <typename T, typename... types> struct untuple<std::tuple<T, types...>> { | |
using type = T; // < XXX: do some meaningful stuff | |
}; | |
int main() { untuple<std::tuple<int, int, int>>::type k = 2; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment