[Interest] initialising a dictionary-type container instance with a static table?

Konstantin Tokarev annulen at yandex.ru
Mon Jan 2 18:09:01 CET 2017



02.01.2017, 16:16, "Thiago Macieira" <thiago.macieira at intel.com>:
> On segunda-feira, 2 de janeiro de 2017 12:36:10 BRST Shawn Rutledge wrote:
>>  It’s an interesting point though, if you have a fixed set of data then you
>>  could use a perfect hash and a perfect number of buckets. There’s
>>  undoubtedly some other library which can do that.
>
> It's called gperf.

I would recommend using re2c instead.

1. It integrates with source code nicely. You just write comment in re2c language right inside your C++ or C code and it is replaced by generated code. No need to have separate gperf input file for each lookup table, containing mix of C++ and gperf configuration which is not IDE-friendly. 

2. If you are writing tokenizer, gperf requires you to extract word from input text before you can match it against table, while with re2c you can match tokens on the fly while you are scanning text

>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 
Regards,
Konstantin



More information about the Interest mailing list