diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8bbd2b7 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +CXX=g++ +CPPFLAGS=-Wall -g -std=c++0x +# CPPFLAGS=-Wall -g + +all: + @echo "build things individually (make loops, etc.)" + +clean: + @rm -vf auto constexpr ilists2 ilists init init_new loops diff --git a/ilists.cc b/ilists.cc new file mode 100644 index 0000000..469e9b9 --- /dev/null +++ b/ilists.cc @@ -0,0 +1,17 @@ +#include + + +// valid c++03: +struct thang +{ + float f; + int i; +}; + +thang scalar = {3.14, 42}; +thang anArray[] = {{1.1, 1}, {2.2, 2}, {3.3, 3}}; + +int main() { + // vector v = { ??? } + return 0; +} diff --git a/ilists2.cc b/ilists2.cc new file mode 100644 index 0000000..c26f95f --- /dev/null +++ b/ilists2.cc @@ -0,0 +1,7 @@ +void function_name(std::initializer_list list); + +function_name({1.0f, -3.45f, -0.4f}); + +int main() { + return 0; +} diff --git a/init.cc b/init.cc new file mode 100644 index 0000000..cb0d3c3 --- /dev/null +++ b/init.cc @@ -0,0 +1,18 @@ +#include +using namespace std; + +struct Point { + int x, y; + Point(int x, int y): x(x), y(y){} +}; + +// const vector v = ??; +// http://stackoverflow.com/a/4268956 + +int main() { + string s1("first"); + int x = int(42); + string s2 = "hello"; + int y = 42; + return 0; +} diff --git a/init_new.cc b/init_new.cc new file mode 100644 index 0000000..4072134 --- /dev/null +++ b/init_new.cc @@ -0,0 +1,21 @@ +#include +#include +#include +using namespace std; + +struct Point { + int x, y; + Point(int x, int y): x{x}, y{y}{} +}; + +const vector s = {"a", "b", "c"}; + +int main() { + string s1 {"first"}; + int x {42}; + map singers = { + {"Freddie Mercury", 100}, + {"Matt Bellamy", 100}, + }; + return 0; +} diff --git a/stub/Makefile b/stub/Makefile deleted file mode 100644 index 5ce1430..0000000 --- a/stub/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -CXX=clang++ -CPPFLAGS=-Wall -g -std=c++0x -SOURCES=main.cc -OBJECTS=$(SOURCES:.cc=.o) -EXE=app - -all: $(EXE) - -main.o: main.cc - -$(EXE): $(OBJECTS) - $(CXX) $(LDFLAGS) $(OBJECTS) -o $@ - -run: $(EXE) - ./$(EXE) - -clean: - @rm -vf *.o - @rm -rvf *.dSYM - @rm -vf $(EXE) - -debug: $(EXE) - gdb $(EXE) - -valgrind: $(EXE) - valgrind --tool=memcheck --leak-check=yes ./$(EXE) diff --git a/stub/main.cc b/stub/main.cc deleted file mode 100644 index 1b0fe30..0000000 --- a/stub/main.cc +++ /dev/null @@ -1,13 +0,0 @@ -#include -using namespace std; - -const string usage = "usage: regex"; - -int main(int argc, char * argv []) { - if(argc != 1) { - cerr << usage << endl; - return 1; - } - cout << "hello cruel world" << endl; - return 0; -}