From 8ddcdfd33edf44303c54f2fb79f3e54920222643 Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Thu, 6 Dec 2001 16:20:33 +0000 Subject: [PATCH] added more warnings and examples [SVN r11956] --- include/boost/graph/iteration_macros.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/boost/graph/iteration_macros.hpp b/include/boost/graph/iteration_macros.hpp index 05a2813f..8ee138e3 100644 --- a/include/boost/graph/iteration_macros.hpp +++ b/include/boost/graph/iteration_macros.hpp @@ -28,6 +28,27 @@ BGL_FORALL_VERTICES(v, g, graph_t) { bar(v); } + + Instead write this: + + if (sky_is_blue) { + BGL_FORALL_VERTICES(v, g, graph_t) { + bar(v); + } + } + + Another example of what NOT to write: + + BGL_FORALL_VERTICES(u, g, graph_t) + BGL_FORALL_VERTICES(u, v, g, graph_t) + foo(u, v); + + Instead write this + + BGL_FORALL_VERTICES(u, g, graph_t) { + BGL_FORALL_VERTICES(u, v, g, graph_t) + foo(u, v); + } It is OK to use single statements after the macro: