Skip to content
Snippets Groups Projects
Commit 3fe52527 authored by Christian Engwer's avatar Christian Engwer
Browse files

[gmpfield, bugfix] restrict the matching of the templated constructor

The templated constructor of GMPField fatched everything. We reduce the constructor
to those scalar values, which are convertible to mpf_class. As this removes the constructor
from char* we explicitly add constructor from char* and std::string.

This is the main part to fix FS#1665
parent bde9dc6e
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@
*/
#include <iostream>
#include <string>
#if HAVE_GMP
......@@ -23,11 +24,31 @@ namespace Dune
typedef mpf_class Base;
public:
/** default constructor, iitialize to zero */
GMPField ()
: Base(0,precision)
{}
template< class T >
/** \brief initialize from a string
\note this is the only reliable way to initialize with higher values
*/
GMPField ( const char* str )
: Base(str,precision)
{}
/** \brief initialize from a string
\note this is the only reliable way to initialize with higher values
*/
GMPField ( const std::string& str )
: Base(str,precision)
{}
/** \brief initialize from a compatible scalar type
*/
template< class T,
typename EnableIf = typename std::enable_if<
std::is_convertible<T, mpf_class>::value>::type
>
GMPField ( const T &v )
: Base( v,precision )
{}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment