Commit 01e7f4b4 authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud

kmerstore.h: satisfy clang

For an unknown reason, Clang complained about the line:
seed = IKmerStore<T>::seed
because “error: no viable overloaded '='”
It seemed to interpret one of the variable as const (which is not)
as it indicated:
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/basic_string.h:565:7: note: candidate function not viable: 'this' argument has type 'const string' (aka 'const basic_string<char>'),
      but method is not marked const

The solution was to use a local variable. Clang was happy, but I don't
see what really makes the difference.
parent cc19305d
......@@ -356,16 +356,17 @@ Fasta IKmerStore<T>::getLabel(T kmer) const {
template<class T>
vector<T> MapKmerStore<T>::getResults(const seqtype &seq, bool no_revcomp, string seed) {
string local_seed = seed;
if (! seed.size())
seed = IKmerStore<T>::seed;
int s = seed.size();
local_seed = IKmerStore<T>::seed;
int s = local_seed.size();
if ((int)seq.length() < s - 1) {
return vector<T>(0);
}
vector<T> result(seq.length() - s + 1);
for (size_t i=0; i + s < seq.length() + 1; i++) {
seqtype kmer = spaced(seq.substr(i, s), seed);
seqtype kmer = spaced(seq.substr(i, s), local_seed);
// seqtype kmer = seq.substr(i, s);
// cout << kmer << endl << kmer0 << endl << endl ;
if (IKmerStore<T>::revcomp_indexed && no_revcomp) {
......@@ -379,10 +380,11 @@ vector<T> MapKmerStore<T>::getResults(const seqtype &seq, bool no_revcomp, strin
template<class T>
vector<T> ArrayKmerStore<T>::getResults(const seqtype &seq, bool no_revcomp, string seed) {
string local_seed = seed;
if (! seed.size())
seed = IKmerStore<T>::seed;
int s = seed.size();
local_seed = IKmerStore<T>::seed;
int s = local_seed.size();
int N = (int)seq.length();
......@@ -400,7 +402,7 @@ vector<T> ArrayKmerStore<T>::getResults(const seqtype &seq, bool no_revcomp, str
/* Compute results */
for (size_t i=0; (int) i+s < N+1; i++) {
int kmer = spaced_int(intseq + i, seed);
int kmer = spaced_int(intseq + i, local_seed);
if (IKmerStore<T>::revcomp_indexed && no_revcomp) {
result[i] = store[kmer]; // getfromint(kmer); // store[kmer];
// cout << i << "/" << N << " " << kmer << result[i] << endl ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment