Ich bin von g++
3.3 im folgenden Code einen seltsamen Fehler bekommen:C++ zwei oder mehr Datentypen in Deklaration
#include <bitset>
#include <string>
using namespace std;
template <int N, int M>
bitset<N> slice_bitset(const bitset<M> &original, size_t start) {
string str = original.to_string<char, char_traits<char>, allocator<char> >();
string newstr = str.substr(start, N);
return bitset<N>(newstr);
}
int main() {
bitset<128> test;
bitset<12> result = slice_bitset<12, 128>(test, 0);
return 0;
}
Der Fehler wird wie folgt dar:
In function `std::bitset slice_bitset(const std::bitset&, unsigned int)': syntax error before `,' token `char_traits' specified as declarator-id two or more data types in declaration of `char_traits' `allocator' specified as declarator-id two or more data types in declaration of `allocator' syntax error before `>' token
Es muss sein etwas wirklich albernes, aber ich habe es schon meiner Gummiente und einem Freund vergebens erzählt.
Danke, Lazyweb.
+1 für die Angabe an Ihre Gummiente. – Robert