Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-common
Commits
de430584
Commit
de430584
authored
10 years ago
by
Christoph Grüninger
Browse files
Options
Downloads
Patches
Plain Diff
[cleanup] Remove fall-back code for hashing.
There is more macro magic to be removed.
parent
fda5a9e0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
config.h.cmake
+1
-0
1 addition, 0 deletions
config.h.cmake
dune/common/bigunsignedint.hh
+0
-4
0 additions, 4 deletions
dune/common/bigunsignedint.hh
dune/common/hash.hh
+1
-145
1 addition, 145 deletions
dune/common/hash.hh
m4/cxx11_compiler.m4
+1
-0
1 addition, 0 deletions
m4/cxx11_compiler.m4
with
3 additions
and
149 deletions
config.h.cmake
+
1
−
0
View file @
de430584
...
...
@@ -30,6 +30,7 @@
/* As these are now always supported due to the new compiler requirements, they are directly */
/* defined without an explicit test. */
#define HAVE_INTEGRAL_CONSTANT 1
#define HAVE_DUNE_HASH 1
#define HAVE_STD_HASH 1
#define HAVE_TYPE_TRAITS 1
#define HAVE_VARIADIC_TEMPLATES 1
...
...
This diff is collapsed.
Click to expand it.
dune/common/bigunsignedint.hh
+
0
−
4
View file @
de430584
...
...
@@ -134,15 +134,11 @@ namespace Dune
friend
class
bigunsignedint
<
k
/
2
>
;
friend
struct
std
::
numeric_limits
<
bigunsignedint
<
k
>
>
;
#if HAVE_DUNE_HASH
inline
friend
std
::
size_t
hash_value
(
const
bigunsignedint
&
arg
)
{
return
hash_range
(
arg
.
digit
,
arg
.
digit
+
arg
.
n
);
}
#endif // HAVE_DUNE_HASH
private
:
unsigned
short
digit
[
n
];
#if HAVE_MPI
...
...
This diff is collapsed.
Click to expand it.
dune/common/hash.hh
+
1
−
145
View file @
de430584
...
...
@@ -3,32 +3,9 @@
#ifndef DUNE_COMMON_HASH_HH
#define DUNE_COMMON_HASH_HH
#include
<dune/common/typetraits.hh>
#if HAVE_STD_HASH
#include
<functional>
#endif
#if HAVE_TR1_HASH
#include
<tr1/functional>
#endif
#if HAVE_DUNE_BOOST
#include
<boost/version.hpp>
// Boost 1.34.0 seems to be the first usable version of boost::functional::hash
#if BOOST_VERSION >= 103400
#define HAVE_BOOST_HASH 1
// only pull in boost if really necessary
#if !HAVE_STD_HASH && !HAVE_TR1_HASH
#include
<boost/functional/hash.hpp>
#endif // !HAVE_STD_HASH && !HAVE_TR1_HASH
#endif // BOOST_VERSION >= 103400
#endif // HAVE_DUNE_BOOST
#include
<dune/common/typetraits.hh>
/**
* \file
...
...
@@ -55,10 +32,6 @@ namespace Dune {
* The interface outlined below is compatible with std::hash, std::tr1::hash and
* boost::hash, so it is possible to use Dune::hash in associative containers from
* those libraries.
*
* The current implementation piggybacks on top of C++11, TR1 or Boost, in that order.
* As there is no local fallback implementation, hashing will not work without at least
* one of those dependencies installed.
*/
template
<
typename
T
>
struct
hash
...
...
@@ -149,12 +122,6 @@ namespace Dune {
// C++11 support
// ********************************************************************************
#if HAVE_STD_HASH
// We have std::hash from C++11
// Announce that we provide Dune::hash
#define HAVE_DUNE_HASH 1
// import std::hash into Dune namespace
namespace
Dune
{
...
...
@@ -179,70 +146,6 @@ namespace Dune {
\
} \
#else // HAVE_STD_HASH
// We do not support std::hash, so don't do anything here.
#define DUNE_DEFINE_STD_HASH(template_args,type)
#endif // HAVE_STD_HASH
// ********************************************************************************
// TR1 support
// ********************************************************************************
#if HAVE_TR1_HASH
// We have std::tr1::hash from TR1
#ifndef HAVE_DUNE_HASH
// std::hash wasn't found, so use std::tr1::hash
// Announce that we provide Dune::hash
#define HAVE_DUNE_HASH 1
// import std::tr1::hash into Dune namespace
namespace
Dune
{
using
std
::
tr1
::
hash
;
}
#endif // HAVE_DUNE_HASH
// Macro for defining a std::tr1::hash specialization for type.
// This should not be called directly. Call DUNE_DEFINE_HASH
// instead.
#define DUNE_DEFINE_TR1_HASH(template_args,type) \
namespace std { \
namespace tr1 { \
\
template<template_args> \
struct hash<type> \
{ \
std::size_t operator()(const type& arg) const \
{ \
return hash_value(arg); \
} \
}; \
\
} \
} \
#else // HAVE_TR1_HASH
// We do not support std::tr1::hash, so don't do anything here.
#define DUNE_DEFINE_TR1_HASH(template_args,type)
#endif // HAVE_TR1_HASH
// ********************************************************************************
// common macros for both C++11 and TR1 support
// ********************************************************************************
#if HAVE_STD_HASH || HAVE_TR1_HASH
// Wrapper macro for template arguments.
// This is required because the template arguments can contain commas,
...
...
@@ -267,50 +170,7 @@ namespace Dune {
// Define specializations for all discovered hash implementations.
#define DUNE_DEFINE_HASH(template_args,type) \
DUNE_DEFINE_STD_HASH(DUNE_HASH_EXPAND_VA_ARGS template_args, DUNE_HASH_EXPAND_VA_ARGS type) \
DUNE_DEFINE_TR1_HASH(DUNE_HASH_EXPAND_VA_ARGS template_args,DUNE_HASH_EXPAND_VA_ARGS type) \
#else // HAVE_STD_HASH || HAVE_TR1_HASH
// Fallback implementation that doesn't do anything.
#define DUNE_DEFINE_HASH(template_args,type)
// Consider DUNE_HASH_TEMPLATE_ARGS as an argument-less macro and
// replace it with an empty token.
// This will leave its arguments in parentheses, causing them
// to be considered as a single argument to DUNE_DEFINE_HASH, which
// will ignore them anyway.
#define DUNE_HASH_TEMPLATE_ARGS
// Replace DUNE_HASH_TYPE with an empty token. See above for rationale.
#define DUNE_HASH_TYPE
#endif // HAVE_STD_HASH || HAVE_TR1_HASH
// ********************************************************************************
// Boost support
// ********************************************************************************
#if !HAVE_DUNE_HASH && HAVE_BOOST_HASH
// We haven't found a hash implementation yet and Boost is available
// Announce that we provide Dune::hash
#define HAVE_DUNE_HASH 1
// import boost::hash into Dune namespace
namespace
Dune
{
using
boost
::
hash
;
}
// We no not need to register our types with boost::hash, as its extension
// mechanism will automatically pick up the global hash_value() functions.
#endif // !HAVE_DUNE_HASH && HAVE_BOOST_HASH
#endif // DOXYGEN
...
...
@@ -320,8 +180,6 @@ namespace Dune {
// Some utility functions for combining hashes of member variables.
// ********************************************************************************
#if HAVE_DUNE_HASH || defined(DOXYGEN)
namespace
Dune
{
// The following functions are an implementation of the proposed hash extensions for
...
...
@@ -475,6 +333,4 @@ namespace Dune {
}
// end namespace Dune
#endif // HAVE_DUNE_HASH || defined(DOXYGEN)
#endif // DUNE_COMMON_HASH_HH
This diff is collapsed.
Click to expand it.
m4/cxx11_compiler.m4
+
1
−
0
View file @
de430584
...
...
@@ -66,6 +66,7 @@ AC_DEFUN([CXX11],[
# set feature support macros for backwards compatibility
AC_DEFINE(HAVE_INTEGRAL_CONSTANT, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_DUNE_HASH, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_STD_HASH, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_TYPE_TRAITS, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
AC_DEFINE(HAVE_VARIADIC_TEMPLATES, 1, [THIS MACRO IS DEPRECATED AND ONLY KEPT FOR BACKWARDS COMPATIBILITY UNTIL THE NEXT RELEASE!])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment