stlab/adobe_source_libraries — pull request #9 by fosterbrereton (2013-11-01 22:34:23+00:00)
Title: Overhaul of adobe::name_t

Note that this is still a standing pull request - adobe/name.hpp and its source are unchanged in this branch as of yet. All the work is currently being done in test/name_overhaul/ for the moment. I'll work on migrating the new name_t over soon.

Here's the output of the test app:

Built with ADOBE_NAME_DEBUG=1

hash: 0x38d1334144987bf4
"Hello, world!"_name should hash to 0x38d1334144987bf4:
[ 'Hello, world!', 0x38d1334144987bf4 ]
hello_world (N5adobe13static_name_tE): [ 'Hello, world!', 0x38d1334144987bf4 ]
foo (N5adobe13static_name_tE): [ 'Red Sox', 0xc5746070bacfea32 ]
bar (N5adobe6name_tE): [ 'Red Sox', 0x0x101b29145 ]
baz (N5adobe6name_tE): [ 'Cardinals', 0x0x101b2914d ]
nullname (N5adobe6name_tE): [ '', 0x0x101b29157 ]

static_cast(foo) (N5adobe6name_tE): [ 'Red Sox', 0x0x101b29145 ]

foo == bar: true
foo != bar: false

foo == baz: false
foo != baz: true

bar == baz: false
bar != baz: true

foo < bar: false
bar < foo: false

foo < baz: false
baz < foo: true

bar < baz: false
baz < bar: true

foo is null: false
nullname is null: true

Before slow sort:
[ 'fig', 0x0x101b29255 ]
[ 'apple', 0x0x101b29259 ]
[ 'banana', 0x0x101b2925f ]
[ 'eggplant', 0x0x101b29266 ]
[ 'grape', 0x0x101b2926f ]
[ 'horseradish', 0x0x101b29275 ]
[ 'daikon', 0x0x101b29281 ]
[ 'carrot', 0x0x101b29288 ]
After slow sort:
[ 'apple', 0x0x101b29259 ]
[ 'banana', 0x0x101b2925f ]
[ 'carrot', 0x0x101b29288 ]
[ 'daikon', 0x0x101b29281 ]
[ 'eggplant', 0x0x101b29266 ]
[ 'fig', 0x0x101b29255 ]
[ 'grape', 0x0x101b2926f ]
[ 'horseradish', 0x0x101b29275 ]
Before fast sort:
[ 'eggplant', 0x0x101b29266 ]
[ 'horseradish', 0x0x101b29275 ]
[ 'daikon', 0x0x101b29281 ]
[ 'banana', 0x0x101b2925f ]
[ 'carrot', 0x0x101b29288 ]
[ 'grape', 0x0x101b2926f ]
[ 'apple', 0x0x101b29259 ]
[ 'fig', 0x0x101b29255 ]
After fast sort:
[ 'fig', 0x0x101b29255 ]
[ 'apple', 0x0x101b29259 ]
[ 'banana', 0x0x101b2925f ]
[ 'eggplant', 0x0x101b29266 ]
[ 'grape', 0x0x101b2926f ]
[ 'horseradish', 0x0x101b29275 ]
[ 'daikon', 0x0x101b29281 ]
[ 'carrot', 0x0x101b29288 ]

EXIT STATUS: 0