Le 6 févr. 2013 à 11:59, [email protected] a écrit :
> 3. In my project I switched from std::string* to boost::shared_ptr<const
> std::string> type for storing filename in yy::position class. In order to do
> this I use custom position.hh file. I think it may be good to modify bison
> code so it will allow to provide type which will be used for storing
> filenames.
I agree, but I'm not sure how to do this properly. I need
to be able to initialize the filename, to "deference" it
to display and compare it etc.
Pointers are to be initialized with YY_NULL. Templates can
help on this issue.
But how can I write code that would appropriately dereference
a pointer, and a shared_ptr? This is less clear.
It should support things like
%define api.location.file.type {std::string}
%define api.location.file.type {std::string*}
%define api.location.file.type {std::shared_ptr<std::string>}
%define api.location.file.type {boost::flyweight<std::string>}