Skip to content
Snippets Groups Projects
Forked from Core Modules / dune-common
Source project has a limited visibility.
  • Christian Engwer's avatar
    76733f41
    [hash] · 76733f41
    Christian Engwer authored
    Add basic support for hashing using Dune::hash
    
    This patch introduces the functor Dune::hash in a similar manner to
    other C++11 functionality by importing the definition from namespace std.
    
    Apart from that, the patch also provides some basic functionality to simplify
    making user-defined types hashable, in particular functions for combining hashes
    and hashing iterator ranges as well as a mechanism for defining the struct
    specializations required by std::hash and std::tr1::hash in the correct namespace.
    
    The current implementation will first try to use std::hash and, if that fails,
    attempt to fall back on std::tr1::hash. If that is not available either, hash
    support is disabled as there is no homegrown fallback for now.
    The extension mechanism will register the type with both std::hash and std::tr1::hash,
    if available. This should make it possible to use unordered_{set,map} from both C++11
    and TR1 without having to specify a custom hasher.
    
    Kudos to Steffen Müthing, see FS#1192
    
    [[Imported from SVN: r7065]]
    76733f41
    History
    [hash]
    Christian Engwer authored
    Add basic support for hashing using Dune::hash
    
    This patch introduces the functor Dune::hash in a similar manner to
    other C++11 functionality by importing the definition from namespace std.
    
    Apart from that, the patch also provides some basic functionality to simplify
    making user-defined types hashable, in particular functions for combining hashes
    and hashing iterator ranges as well as a mechanism for defining the struct
    specializations required by std::hash and std::tr1::hash in the correct namespace.
    
    The current implementation will first try to use std::hash and, if that fails,
    attempt to fall back on std::tr1::hash. If that is not available either, hash
    support is disabled as there is no homegrown fallback for now.
    The extension mechanism will register the type with both std::hash and std::tr1::hash,
    if available. This should make it possible to use unordered_{set,map} from both C++11
    and TR1 without having to specify a custom hasher.
    
    Kudos to Steffen Müthing, see FS#1192
    
    [[Imported from SVN: r7065]]