git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: make arg in fn application operator a const ref
commitfb511d9c50552c579c4d74b8adf35e7d00d49318 authorAndy Arvanitis <andyarvanitis@gmail.com> dateMon 4 Jan 2016, 22:21 (11 years ago) parent1809925
2 files changed+4−3
pcc/include/purescript.cc+1−1 pcc/include/purescript.hh+3−2
pcc/include/purescript.cc+1−1
@@ -136,7 +136,7 @@ any::~any() {
136136 template auto any::cast<any::vector>() const -> const vector&;
137137
138138
139− auto any::operator()(const any arg) const -> any {
139+ auto any::operator()(const any& arg) const -> any {
140140 if (type == Type::Function) {
141141 return (*f)(arg);
142142 }
pcc/include/purescript.hh+3−2
@@ -141,7 +141,8 @@ class any {
141141 any(const shared<fn>& val) : type(Type::Function), f(val) {}
142142 any(shared<fn>&& val) : type(Type::Function), f(std::move(val)) {}
143143
144− template <typename T>
144+ template <typename T,
145+ typename = typename std::enable_if<!std::is_same<any,T>::value>::type>
145146 any(const T& val, typename std::enable_if<std::is_assignable<fn,T>::value>::type* = 0)
146147 : type(Type::Function), f(make_shared<fn>(val)) {}
147148
@@ -230,7 +231,7 @@ class any {
230231 return nullptr;
231232 }
232233
233− auto operator()(const any) const -> any;
234+ auto operator()(const any&) const -> any;
234235
235236 auto operator()(const as_thunk) const -> const any&;
236237