Commit 58878cd4 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

Work around the clang version installed with MacOS X 10.9.

Apparently their hash tables store the hash functions in a const
member, and this requires a user-supplied default constructor.
Reported by Étienne Renault.

* src/misc/hash.hh: Add an empty constructor to all hash functions.
parent 0b5f63c2
// Copyright (C) 2008, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2011, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de
// Paris 6 (LIP6), dpartement Systmes Rpartis Coopratifs (SRC),
// Universit Pierre et Marie Curie.
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
......@@ -80,6 +81,13 @@ namespace spot
struct ptr_hash :
public std::unary_function<const T*, size_t>
{
// A default constructor is needed if the ptr_hash object is
// stored in a const member. This occur with the clang version
// installed by OS X 10.9.
ptr_hash()
{
}
size_t operator()(const T* p) const
{
return knuth32_hash(reinterpret_cast<const char*>(p)
......@@ -97,6 +105,12 @@ namespace spot
public Sgi::hash<const char*>,
public std::unary_function<const std::string&, size_t>
{
// A default constructor is needed if the string_hash object is
// stored in a const member.
string_hash()
{
}
size_t operator()(const std::string& s) const
{
// We are living dangerously. Be sure to call operator()
......@@ -113,6 +127,12 @@ namespace spot
struct identity_hash:
public std::unary_function<const T&, size_t>
{
// A default constructor is needed if the string_hash object is
// stored in a const member.
identity_hash()
{
}
size_t operator()(const T& s) const
{
return s;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment