| 250 | |
| 251 | template <typename F> |
| 252 | void for_index ( |
| 253 | F& funct, |
| 254 | long idx |
| 255 | ) |
| 256 | { |
| 257 | // do this #ifdef stuff to avoid getting a warning about valid_idx not being |
| 258 | // used when ENABLE_ASSERTS isn't defined. |
| 259 | #ifdef ENABLE_ASSERTS |
| 260 | const bool valid_idx = tuple_helpers::for_each<tuple,F>::go(*this,funct,idx); |
| 261 | #else |
| 262 | tuple_helpers::for_each<tuple,F>::go(*this,funct,idx); |
| 263 | #endif |
| 264 | DLIB_ASSERT(valid_idx, |
| 265 | "\tvoid tuple::for_index()" |
| 266 | << "\n\tYou have attempted to call for_index() with an index out of the valid range" |
| 267 | << "\n\tidx: " << idx |
| 268 | << "\n\tthis: " << this |
| 269 | ); |
| 270 | } |
| 271 | |
| 272 | template <typename F> |
| 273 | void for_index ( |