Skip to content

Instantly share code, notes, and snippets.

@david50407
Created June 19, 2019 11:12
Show Gist options
  • Save david50407/5801bccfc96c1f7a40b586000479c341 to your computer and use it in GitHub Desktop.
Save david50407/5801bccfc96c1f7a40b586000479c341 to your computer and use it in GitHub Desktop.
#include <vector>
template<typename itor>
void func(itor x) {
typedef typename std::iterator_traits<itor>::value_type T;
T value = *x;
}
int main(void) {
std::vector<int> vec;
vec.push_back(1);
func(vec.begin());
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment