Skip to content

Instantly share code, notes, and snippets.

@oschulz
Last active August 8, 2016 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oschulz/0fe9890da85931e87fd1dd5cbf311d15 to your computer and use it in GitHub Desktop.
Save oschulz/0fe9890da85931e87fd1dd5cbf311d15 to your computer and use it in GitHub Desktop.
using Cxx
cxx"""
#include <iostream>
class MyClass {
public:
int i = 0;
MyClass() { std::cerr << "INFO: MyClass()" << std::endl; }
MyClass(int j) : i(j) { std::cerr << "INFO: MyClass(" << i << ")" << std::endl; }
MyClass(const MyClass &other) { std::cerr << "INFO: MyClass()" << std::endl; }
~MyClass() { std::cerr << "INFO: ~MyClass()" << std::endl; }
};
"""
a = @cxx MyClass(42)
b = icxx""" MyClass(43); """
info("Objects constructed: $a, $b")
info("Stack allocated: $(isbits(a)), $(isbits(b))")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment