Mirror reflection library - Lagoon run-time layer 0.5.13

lagoon/example/various_02.cpp

This example shows the usage of the various utilities provided by Lagoon

1* Copyright 2008-2011 Matus Chochlik. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <mirror/mirror.hpp>
#include <lagoon/lagoon.hpp>
#include <lagoon/range/contains.hpp>
#include <iostream>

int main(void)
{
    using namespace lagoon;
    // check for classes in the global scope
    std::cout << (contains(
        reflected_global_scope()->members(),
        [](const shared<meta_named_scoped_object>& member)
        {
            return member->is_class();
        }
    ) ? "Some" : "No") << " classes in the global scope" << std::endl;
    // check for class templates in the global scope
    std::cout << (contains(
        reflected_global_scope()->members(),
        [](const shared<meta_named_scoped_object>& member)
        {
            return member->is_type_template();
        }
    ) ? "Some" : "No") << " class templates in the global scope" << std::endl;
    //
    return 0;
}

/* Example of output:
No classes in the global scope
No class templates in the global scope
*/

Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.