Skip to content

Instantly share code, notes, and snippets.

@robertshepherdcpp
Created December 21, 2022 13:13
Show Gist options
  • Save robertshepherdcpp/3acee392edd90fdec66282cad126f3e3 to your computer and use it in GitHub Desktop.
Save robertshepherdcpp/3acee392edd90fdec66282cad126f3e3 to your computer and use it in GitHub Desktop.
How to use the decreasing tuple idiom.
#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