From c9642f8c99bbe39f05b2c467584efea4d9d3a300 Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Fri, 4 Nov 2011 16:26:49 +0100 Subject: [PATCH] more consistency --- brainfuck/brainfuck.hpp | 15 ++++++++++----- iterators/counting_iterator.hpp | 22 +++++++++++++--------- nd_array/nd_array.hpp | 6 +++--- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/brainfuck/brainfuck.hpp b/brainfuck/brainfuck.hpp index 8c91e21..b634e2f 100644 --- a/brainfuck/brainfuck.hpp +++ b/brainfuck/brainfuck.hpp @@ -5,15 +5,18 @@ // Copyright 2011 Vadovas. All rights reserved. // +/* + T is the memory-type (normally bytes aka char) + OutputIterator is where to write (normally cout) + */ + +#ifndef BRAINFUCK_HPP +#define BRAINFUCK_HPP + #include #include #include -/** - T is the memory-type (normally bytes aka char) - OutputIterator is where to write (normally cout) -*/ - namespace brainfuck_details { // recursive funtion (from http://www.xs4all.nl/~weegen/eelis/geordi/) but templated @@ -75,3 +78,5 @@ void brainfuck(std::string prg, InputIterator inp, OutputIterator it = brainfuck brainfuck_details::b(c,inp,p,it); } + +#endif // BRAINFUCK_HPP diff --git a/iterators/counting_iterator.hpp b/iterators/counting_iterator.hpp index 4ffc0ec..caaf974 100644 --- a/iterators/counting_iterator.hpp +++ b/iterators/counting_iterator.hpp @@ -6,19 +6,21 @@ // /* + USAGE: + "for(auto x : counted(v)) { ... x.value ... x.index ... }" + x.value is a reference to the element in the container (so you can change it's value), x.index is what it is. + Container should havae forward iterators. -USAGE: -"for(auto x : counted(v)) { ... x.value ... x.index ... }" -x.value is a reference to the element in the container (so you can change it's value), x.index is what it is. -Container should havae forward iterators. + NOTE: + This headers is purely a handy tool for the "for(auto x : counter(v))"-syntax. Using it explicitly with iterators is not recommended! -NOTE: -This headers is purely a handy tool for the "for(auto x : counter(v))"-syntax. Using it explicitly with iterators is not recommended! + NOTE: + There is no const version of it. Doing "for(const auto x : counted(v))" doesn't make it impossible to change x (so the element in the container can be modified). + */ -NOTE: -There is no const version of it. Doing "for(const auto x : counted(v))" doesn't make it impossible to change x (so the element in the container can be modified). +#ifndef COUNTING_ITERATOR_HPP +#define COUNTING_ITERATOR_HPP -*/ #include // A reference is a struct, yuk... @@ -102,3 +104,5 @@ counting_container counted(Container& c){ return counting_container(c); } +#endif // COUNTING_ITERATOR_HPP + diff --git a/nd_array/nd_array.hpp b/nd_array/nd_array.hpp index cfe08c8..165e09a 100644 --- a/nd_array/nd_array.hpp +++ b/nd_array/nd_array.hpp @@ -16,8 +16,8 @@ It is templated in number of dimensions (and of course type). With extra effort you could make the dimension dynamic (ie not compile-time, but run-time), I leave that as an excercise to the reader. */ -#ifndef AwesomeAttractorND_nd_array_hpp -#define AwesomeAttractorND_nd_array_hpp +#ifndef ND_ARRAY_HPP +#define ND_ARRAY_HPP #include #include @@ -153,4 +153,4 @@ private: std::array sizes; }; -#endif +#endif // ND_ARRAY_HPP