Created
December 21, 2022 13:13
-
-
Save robertshepherdcpp/3acee392edd90fdec66282cad126f3e3 to your computer and use it in GitHub Desktop.
How to use the decreasing tuple idiom.
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
#include<tector.hpp> | |
#include<iostream> | |
int main() | |
{ | |
tector<int, int, int, int> t{3, 5, 4, 1}; | |
t.remove_first(); // so now we just have the elements 5, 4, 1 | |
// Now we can call remove_first again like this: | |
t.remove_first(); // Now we have the elements 4, 1 | |
std::cout << t.get<0>(); // output: 4 | |
std::cout << t.get<1>(); // output: 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment