ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Ivan A. Melnikov" <iv@altlinux.org>
To: devel@lists.altlinux.org
Subject: Re: [devel] boost: SimGear
Date: Thu, 6 Sep 2012 16:05:06 +0400
Message-ID: <20120906160506.44cfd459@deimos.localdomain> (raw)
In-Reply-To: <20120906074722.GX22718@osdn.org.ua>

[-- Attachment #1: Type: text/plain, Size: 1879 bytes --]

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

[-- Attachment #2: SimGear-2.8.0-alt-boost-1.51.0-compatibility.patch --]
[-- Type: text/x-patch, Size: 509 bytes --]

diff --git a/SimGear/simgear/scene/material/Effect.cxx b/SimGear/simgear/scene/material/Effect.cxx
index 2e10318..5c839d6 100644
--- a/SimGear/simgear/scene/material/Effect.cxx
+++ b/SimGear/simgear/scene/material/Effect.cxx
@@ -76,6 +76,14 @@
 #include <simgear/structure/SGExpression.hxx>
 #include <simgear/props/vectorPropTemplates.hxx>
 
+namespace osg
+{
+    std::size_t hash_value(osg::Shader::Type t)
+    {
+        return boost::hash_value(static_cast<int>(t));
+    }
+}
+
 
 namespace simgear
 {

  parent reply	other threads:[~2012-09-06 12:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06  7:47 ` Michael Shigorin
2012-09-06  8:11   ` Ivan A. Melnikov
2012-09-06 12:05   ` Ivan A. Melnikov [this message]
2012-09-06 17:51     ` Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120906160506.44cfd459@deimos.localdomain \
    --to=iv@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git