You can implement an iterator for CWalletMap, if you really want BOOST_FOREACH.