[devel] boost: SimGear

Ivan A. Melnikov iv на altlinux.org
Чт Сен 6 16:05:06 MSK 2012


On Thu, 6 Sep 2012 10:47:23 +0300
Michael Shigorin <mike на osdn.org.ua> wrote:

> On Wed, Sep 05, 2012 at 10:01:18PM +0000, ALT beekeeper wrote:
> > SimGear-2.8.0-alt1
> > 	/usr/src/RPM/BUILD/SimGear-2.8.0/simgear/scene/material/Effect.cxx:708:67:
> > instantiated from here
> > 	/usr/include/boost/functional/hash/extensions.hpp:257:34:
> > error: no matching function for call to 'hash_value(const
> > osg::Shader::Type&)' /usr/include/boost/functional/hash/extensions.hpp:257:34:
> > note: candidates are:
> 
> А с этим что делать?
> 

В принципе, сборка чинится приложенным патчем, но мне он не нравится.
История на английском, на случай связи с апстримом:

Since boost 1.51.0 boost::hash_value is implemented using SFINAE to
avoid implicit casts to built in types when calling it [1]. Because of
that compiler can't use boost::hash_value(int) for enum
osg::Shader::Type any more. Thus one can't use osg::Shader::Type as a
(part of) key for boost::unordered_map.

The proper solution is to overload hash_value function for
osg::Shader::Type as described in [2]. This function should be found via
argument dependent lookup (ADL), so it must be defined in osg namespace.
I don't know if it is appropriate for OpenSceneGraph to add it (also it
should not hurt), and how it should be implemented in that case. So in
my patch I put it right into simgear/scene/material/Effect.cxx, which of
course is a dirty hack.

Maybe, the best solution would be to change implementation of
hash_value(const ProgramKey& key) (simgear/scene/material/Effect.cxx,
line 712).

References:

[1] http://www.boost.org/users/history/version_1_51_0.html
[2] http://www.boost.org/doc/libs/1_51_0/doc/html/hash/custom.html

-- 
WBR,
Ivan A. Melnikov
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : SimGear-2.8.0-alt-boost-1.51.0-compatibility.patch
Тип     : text/x-patch
Размер  : 509 байтов
Описание: отсутствует
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20120906/d20842ef/attachment.bin>


Подробная информация о списке рассылки Devel