Skip to content
Snippets Groups Projects
  • Nat Goodspeed's avatar
    d814e76c
    Introduce BOOST_FOREACH() helpers for LLSD in llsdutil.h. · d814e76c
    Nat Goodspeed authored
    You can't directly write:
    BOOST_FOREACH(LLSD item, someLLSDarray) { ... }
    because LLSD has two distinct iteration mechanisms, one for arrays and one for
    maps, neither using the standard [const_]iterator typedefs or begin()/end()
    methods. But with these helpers, you can write:
    BOOST_FOREACH(LLSD item, llsd::inArray(someLLSDarray)) { ... }
    or
    BOOST_FOREACH(const llsd::MapEntry& pair, llsd::inMap(someLLSDmap)) { ... }
    These are in namespace llsd instead of being (e.g.) llsd_inMap because with a
    namespace at least your .cpp file can have a local 'using':
    using namespace llsd;
    BOOST_FOREACH(LLSD item, inArray(someLLSDarray)) { ... }
    It's namespace llsd rather than LLSD because LLSD can't be both a namespace
    and a class name.
    d814e76c
    History
    Introduce BOOST_FOREACH() helpers for LLSD in llsdutil.h.
    Nat Goodspeed authored
    You can't directly write:
    BOOST_FOREACH(LLSD item, someLLSDarray) { ... }
    because LLSD has two distinct iteration mechanisms, one for arrays and one for
    maps, neither using the standard [const_]iterator typedefs or begin()/end()
    methods. But with these helpers, you can write:
    BOOST_FOREACH(LLSD item, llsd::inArray(someLLSDarray)) { ... }
    or
    BOOST_FOREACH(const llsd::MapEntry& pair, llsd::inMap(someLLSDmap)) { ... }
    These are in namespace llsd instead of being (e.g.) llsd_inMap because with a
    namespace at least your .cpp file can have a local 'using':
    using namespace llsd;
    BOOST_FOREACH(LLSD item, inArray(someLLSDarray)) { ... }
    It's namespace llsd rather than LLSD because LLSD can't be both a namespace
    and a class name.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.