Archived
1
Fork 0

more consistency

This commit is contained in:
Joshua Moerman 2011-11-04 16:26:49 +01:00
parent edf2571487
commit c9642f8c99
3 changed files with 26 additions and 17 deletions

View file

@ -5,15 +5,18 @@
// Copyright 2011 Vadovas. All rights reserved. // 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 <iostream> #include <iostream>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
/**
T is the memory-type (normally bytes aka char)
OutputIterator is where to write (normally cout)
*/
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

View file

@ -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: NOTE:
"for(auto x : counted(v)) { ... x.value ... x.index ... }" This headers is purely a handy tool for the "for(auto x : counter(v))"-syntax. Using it explicitly with iterators is not recommended!
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: NOTE:
This headers is purely a handy tool for the "for(auto x : counter(v))"-syntax. Using it explicitly with iterators is not recommended! 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: #ifndef COUNTING_ITERATOR_HPP
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). #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

View file

@ -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