[pypy-commit] pypy reflex-support: enable lazy lookup of templated functions

wlav noreply at buildbot.pypy.org
Thu May 15 09:33:36 CEST 2014


Author: Wim Lavrijsen <WLavrijsen at lbl.gov>
Branch: reflex-support
Changeset: r71528:646b4e87506c
Date: 2014-05-14 23:37 -0700
http://bitbucket.org/pypy/pypy/changeset/646b4e87506c/

Log:	enable lazy lookup of templated functions

diff --git a/pypy/module/cppyy/src/reflexcwrapper.cxx b/pypy/module/cppyy/src/reflexcwrapper.cxx
--- a/pypy/module/cppyy/src/reflexcwrapper.cxx
+++ b/pypy/module/cppyy/src/reflexcwrapper.cxx
@@ -370,9 +370,12 @@
     // unsorted std::vector anyway, so there's no gain to be had in using the
     // Scope::FunctionMemberByName() function
     int num_meth = s.FunctionMemberSize();
+    std::string::size_type name_sz = strlen(name);
     for (int imeth = 0; imeth < num_meth; ++imeth) {
         Reflex::Member m = s.FunctionMemberAt(imeth);
-        if (m.Name() == name) {
+        const std::string& mName = m.Name();
+        if (mName.find(name) == 0 && (mName.size() == name_sz /* exact match */ ||
+            (mName.size() > name_sz && mName[name_sz] == '<') /* template */ )) {
             if (m.IsPublic())
                 result.push_back((cppyy_index_t)imeth);
         }


More information about the pypy-commit mailing list