This is the README for lex_t.

This software is released into the Public Domain by it's author,
stephan beal (stephan@s11n.net).

Download from:

        http://s11n.net/download/#lex_t

========================================================================
INSTALLATION:

Run 'make' with no arguments to see the install istructions.

If you're using gcc, you can run 'make test' to build and run wthe test
app (test.cpp). If you are not running gcc, you'll need to compile
test.cpp yourself.

========================================================================
WHAT IS IT?


lext::lex_t is a "variant" or "any" type for C++, capable of lexically
casting strings and other times type and from each other. It does not
handle pointer types, but can handle any types which meet a few simple
requirements (described in the API docs, in the header file).

It is especially useful in maps<>:

        #include <map>
        #include <s11n.net/lext/lex_t.hpp>
...
        typedef std::map<lext::lex_t,lext::lex_t> LMap;
        LMap map;
        
        map[4] = "one";
        map["one"] = 4;
        map[123] = "eat this";
        map['x'] = "marks the spot";
        map["fred"] = 94.3 * static_cast<double>( map["one"] );
        map["fred"] = 10 * static_cast<double>( map["fred"] );
        map["123"] = "this was re-set";
        int readi = map["one"];


If you also link with libs11n, you can do this:

        #include <s11n.net/s11n/s11nlite.hpp>
        // ^^^ include this BEFORE including lex_t.hpp!!!
...
        s11nlite::node_type node;
        s11n::map::serialize_streamable_map( node,map );
        s11nlite::save( map, std::cout );


Cool, eh?

The serialized data may look different, depending on the Serializer
s11nlite is using:

(s11n::parens)
data_node=(map
        pair=(pair
                first=(lex_t (v 123) )
                second=(lex_t (v this was re-set) )
        )
        pair=(pair
                first=(lex_t (v 4) )
                second=(lex_t (v one) )
        )
        pair=(pair
                first=(lex_t (v fred) )
                second=(lex_t (v 3772.000000) )
        )
        pair=(pair
                first=(lex_t (v one) )
                second=(lex_t (v 4) )
        )
        pair=(pair
                first=(lex_t (v x) )
                second=(lex_t (v marks the spot) )
        )
)



