Skip to content

Instantly share code, notes, and snippets.

@abhi1010
abhi1010 / typename.cpp
Last active September 2, 2015 14:19 — forked from anonymous/typename.cpp
typename usage
template <class T1>
struct OuterStruct
{
T1 mValue;
struct InnerStruct
{
T1 mValue;
};
};
@abhi1010
abhi1010 / gist:554885a7235f4047dae6
Last active September 2, 2015 14:18 — forked from anonymous/gist:0465925390f3442a7691
Tokenize a String
string strToSplit = "splitting strings, in|multiple ways";
std::vector<std::string> words;
boost::split(words, strToSplit, boost::is_any_of("\t ,|"));
std::copy (words.begin(), words.end(), std::ostream_iterator<string>(cout, "\n"));
words.clear();
std::istringstream iss(strToSplit);
std::copy(std::istream_iterator<std::string>(iss), std::istream_iterator<std::string>(), std::back_inserter(words));
std::copy (words.begin(), words.end(), std::ostream_iterator<string>(cout, "\n"));
@abhi1010
abhi1010 / 0_reuse_code.js
Last active August 29, 2015 14:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console