que estoy recibiendo un error extraño de g++
3.3 en el siguiente código:dos o más tipos de datos de C++ en la declaración
#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;
}
El error es el siguiente:
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
tiene que ser algo realmente tonto, pero ya se lo conté a mi pato de goma y a un amigo sin éxito.
Gracias, Lazyweb.
+1 por decírselo a tu pato de goma. – Robert