Browse Source

more consistency

master
Joshua Moerman 13 years ago
parent
commit
c9642f8c99
  1. 15
      brainfuck/brainfuck.hpp
  2. 8
      iterators/counting_iterator.hpp
  3. 6
      nd_array/nd_array.hpp

15
brainfuck/brainfuck.hpp

@ -5,15 +5,18 @@
// Copyright 2011 Vadovas. All rights reserved. // Copyright 2011 Vadovas. All rights reserved.
// //
#include <iostream> /*
#include <iterator>
#include <algorithm>
/**
T is the memory-type (normally bytes aka char) T is the memory-type (normally bytes aka char)
OutputIterator is where to write (normally cout) OutputIterator is where to write (normally cout)
*/ */
#ifndef BRAINFUCK_HPP
#define BRAINFUCK_HPP
#include <iostream>
#include <iterator>
#include <algorithm>
namespace brainfuck_details { namespace brainfuck_details {
// recursive funtion (from http://www.xs4all.nl/~weegen/eelis/geordi/) but templated // 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); brainfuck_details::b(c,inp,p,it);
} }
#endif // BRAINFUCK_HPP

8
iterators/counting_iterator.hpp

@ -6,7 +6,6 @@
// //
/* /*
USAGE: USAGE:
"for(auto x : counted(v)) { ... x.value ... x.index ... }" "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. x.value is a reference to the element in the container (so you can change it's value), x.index is what it is.
@ -17,8 +16,11 @@ This headers is purely a handy tool for the "for(auto x : counter(v))"-syntax. U
NOTE: 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). 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 <iterator> #include <iterator>
// A reference is a struct, yuk... // A reference is a struct, yuk...
@ -102,3 +104,5 @@ counting_container<Container, Integer> counted(Container& c){
return counting_container<Container, Integer>(c); return counting_container<Container, Integer>(c);
} }
#endif // COUNTING_ITERATOR_HPP

6
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. 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 #ifndef ND_ARRAY_HPP
#define AwesomeAttractorND_nd_array_hpp #define ND_ARRAY_HPP
#include <stdexcept> #include <stdexcept>
#include <numeric> #include <numeric>
@ -153,4 +153,4 @@ private:
std::array<size_type, dimension> sizes; std::array<size_type, dimension> sizes;
}; };
#endif #endif // ND_ARRAY_HPP