Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build error on clang #26

Open
jonchang opened this issue Mar 13, 2020 · 1 comment
Open

build error on clang #26

jonchang opened this issue Mar 13, 2020 · 1 comment

Comments

@jonchang
Copy link

c.f. brewsci/homebrew-bio#951

clang doesn't like the overloading here because libc++ implements std::string differently from stdlibc++ in such a way to trigger the bad overload error. I believe libc++ provides a conversion from std::string to std::vector<char> while stdlibc++ does not.

./Integer.hpp:120:5: error: constructor cannot be redeclared
    IntegerTemplate(std::vector<char>::const_iterator begin, std::vector<char>::const_iterator end) : IntegerTemplate(end-begin, 0)  {
    ^
./Integer.hpp:106:5: note: previous definition is here
    IntegerTemplate(std::string::const_iterator begin, std::string::const_iterator end) : IntegerTemplate(end-begin, 0)  {
    ^
diff --git a/Integer.hpp b/Integer.hpp
index ffe6af1..bdc2af8 100644
--- a/Integer.hpp
+++ b/Integer.hpp
@@ -117,13 +117,6 @@ public:
             *this = *this + (std::find(bin2NT.begin(), bin2NT.end(), *i) - bin2NT.begin());
         }
     }
-    IntegerTemplate(std::vector<char>::const_iterator begin, std::vector<char>::const_iterator end) : IntegerTemplate(end-begin, 0)  {
-        for(auto i = begin; i != end; ++i) {
-            *this = (*this) << 2;
-            *this = *this + (std::find(bin2NT.begin(), bin2NT.end(), *i) - bin2NT.begin());
-        }
-    }
-    
 
     /**Construct from a different size IntegerTemplate
        Will clip (or add) extra nucs on the LEFT of the string

Note that c++17 has std::bytes which may be conceptually more appropriate.

@souvorov
Copy link
Collaborator

@jonchang @tseemann I discussed it with our c++ guru and he suggested that, although vector<char> and string are different types, their iterators might be implemented in clang as the same type (char* for example). I'm not convinced and still think it is a clang bug. Since the use of vector<char> constructor is very limited I (reluctantly) changed it to the string constructor and committed to the master. Inadvertently, some code which will be used in the next iteration had to be commited also. Please check if you can use it on macOS/clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants