3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 13:53:40 +01:00

shared_ptr<void> can not be constructed directly in c++14

- Fix for compilation on clang 3.4 in c++1y mode.
This commit is contained in:
Olivier Parcollet 2014-01-07 14:33:57 +01:00
parent b644b38a6a
commit 9474937470
4 changed files with 7 additions and 6 deletions

View File

@ -458,8 +458,9 @@ namespace triqs { namespace clef {
public: public:
function():_fnt_ptr{std::make_shared<std_function_type> ()}{} function():_fnt_ptr{std::make_shared<std_function_type> ()}{}
template<typename Expr, typename... X> template <typename Expr, typename... X>
explicit function(Expr const & _e, X... x) : _exp(new Expr(_e)),_fnt_ptr(new std_function_type(make_function(_e, x...))){} explicit function(Expr const& _e, X... x)
: _exp(std::make_shared<Expr>(_e)), _fnt_ptr(new std_function_type(make_function(_e, x...))) {}
ReturnType operator()(T const &... t) const { return (*_fnt_ptr)(t...);} ReturnType operator()(T const &... t) const { return (*_fnt_ptr)(t...);}
@ -468,7 +469,7 @@ namespace triqs { namespace clef {
template<typename RHS> friend void triqs_clef_auto_assign (function const & x, RHS rhs) { template<typename RHS> friend void triqs_clef_auto_assign (function const & x, RHS rhs) {
* (x._fnt_ptr) = std_function_type (rhs); * (x._fnt_ptr) = std_function_type (rhs);
x._exp = std::shared_ptr <void> (new typename std::remove_cv<decltype(rhs.ex)>::type (rhs.ex)); x._exp = std::make_shared<typename std::remove_cv<decltype(rhs.ex)>::type> (rhs.ex);
} }
}; };

View File

@ -54,7 +54,7 @@ namespace triqs { namespace mc_tools {
template<typename MeasureType> template<typename MeasureType>
void construct_delegation (MeasureType * p) { void construct_delegation (MeasureType * p) {
impl_= std::shared_ptr<void> (p); impl_= std::shared_ptr<MeasureType> (p);
clone_ = [p]() { return MeasureType(*p);} ; clone_ = [p]() { return MeasureType(*p);} ;
hash_ = typeid(MeasureType).hash_code(); hash_ = typeid(MeasureType).hash_code();
type_name_ = typeid(MeasureType).name(); type_name_ = typeid(MeasureType).name();

View File

@ -58,7 +58,7 @@ namespace triqs { namespace mc_tools {
template<typename MoveType> template<typename MoveType>
void construct_delegation (MoveType * p) { void construct_delegation (MoveType * p) {
impl_= std::shared_ptr<void> (p); impl_= std::shared_ptr<MoveType> (p);
hash_ = typeid(MoveType).hash_code(); hash_ = typeid(MoveType).hash_code();
type_name_ = typeid(MoveType).name(); type_name_ = typeid(MoveType).name();
clone_ = [p](){return MoveType(*p);}; clone_ = [p](){return MoveType(*p);};

View File

@ -101,7 +101,7 @@ namespace triqs { namespace utility {
private: private:
template<typename T> void delegate_constructor( T * obj, std::string const & name) { template<typename T> void delegate_constructor( T * obj, std::string const & name) {
p = std::shared_ptr<void> (obj); p = std::shared_ptr<T> (obj);
type_code_ = type_code<T>(); type_code_ = type_code<T>();
name_ = name; name_ = name;
clone_ = [obj,name]() { return _object( *obj, name);} ; clone_ = [obj,name]() { return _object( *obj, name);} ;