Skip to content

Instantly share code, notes, and snippets.

@bkuhns
Last active August 29, 2015 13:55
Show Gist options
  • Save bkuhns/8689289 to your computer and use it in GitHub Desktop.
Save bkuhns/8689289 to your computer and use it in GitHub Desktop.
#include <boost/tuple/tuple.hpp>
#include <string>
using namespace std;
typedef boost::tuple<int, string> tuple_type;
struct inherits_from_tuple : public tuple_type
{
inherits_from_tuple()
: tuple_type(2, "QWERTYUIOP"),
s_("ASDFGHJKLZXCVBNMQWETRYUIOP")
{
}
string s_;
};
int main()
{
while(true) {
tuple_type* test = new inherits_from_tuple();
delete test; //< Leaks the member s because only tuple_type's destructor is called.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment