I'm trying to get the class multi to store a series of function/argument pairs. The functions are of the form:
[code=c]
string funcA (const string argA)
[/code]
I thought that I had all the signatures matching in:
[code=c]
#include <string>
#include <queue>
using namespace std;
typedef string (*attr_func_T) (const string);
typedef const string attr_arg_T;
class multi
{
public:
string invoke (void)
{
string ret_string;
pair<attr_func_ T, attr_arg_T> ret_pair;
ret_pair = call_queueX.fro nt(); /*** LINE 15 ***/
return (ret_string);
}
private:
queue <pair<attr_func _T, attr_arg_T> > call_queueX;
}; /* class multi */
[/code]
I'm getting a horrible error message:
[code=c]
-*- mode: compilation; default-directory: "~/html/" -*-
Compilation started at Fri Dec 18 19:51:35
make -k CPPFLAGS=-Wno-write-strings y
g++ -Wno-write-strings y.cpp -o y
In file included from /usr/include/c++/4.4/bits/stl_algobase.h: 66,
from /usr/include/c++/4.4/bits/char_traits.h:4 1,
from /usr/include/c++/4.4/string:42,
from y.cpp:1:
/usr/include/c++/4.4/bits/stl_pair.h: In member function ‘std::pair<std: :string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >& std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >::operator=(co nst std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >&)’:
/usr/include/c++/4.4/bits/stl_pair.h:68: error: non-static const member ‘const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >::second’, can't use default assignment operator
y.cpp: In member function ‘std::string multi::invoke() ’:
y.cpp:15: note: synthesized method ‘std::pair<std: :string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >& std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >::operator=(co nst std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >&)’ first required here
make: *** [y] Error 1
Compilation exited abnormally with code 2 at Fri Dec 18 19:51:35
[/code]
NOTE: this is not for a class, it is a project i've assigned myself for my own amusement.
[code=c]
string funcA (const string argA)
[/code]
I thought that I had all the signatures matching in:
[code=c]
#include <string>
#include <queue>
using namespace std;
typedef string (*attr_func_T) (const string);
typedef const string attr_arg_T;
class multi
{
public:
string invoke (void)
{
string ret_string;
pair<attr_func_ T, attr_arg_T> ret_pair;
ret_pair = call_queueX.fro nt(); /*** LINE 15 ***/
return (ret_string);
}
private:
queue <pair<attr_func _T, attr_arg_T> > call_queueX;
}; /* class multi */
[/code]
I'm getting a horrible error message:
[code=c]
-*- mode: compilation; default-directory: "~/html/" -*-
Compilation started at Fri Dec 18 19:51:35
make -k CPPFLAGS=-Wno-write-strings y
g++ -Wno-write-strings y.cpp -o y
In file included from /usr/include/c++/4.4/bits/stl_algobase.h: 66,
from /usr/include/c++/4.4/bits/char_traits.h:4 1,
from /usr/include/c++/4.4/string:42,
from y.cpp:1:
/usr/include/c++/4.4/bits/stl_pair.h: In member function ‘std::pair<std: :string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >& std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >::operator=(co nst std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >&)’:
/usr/include/c++/4.4/bits/stl_pair.h:68: error: non-static const member ‘const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >::second’, can't use default assignment operator
y.cpp: In member function ‘std::string multi::invoke() ’:
y.cpp:15: note: synthesized method ‘std::pair<std: :string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >& std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >::operator=(co nst std::pair<std:: string (*)(std::string ), const std::basic_stri ng<char, std::char_trait s<char>, std::allocator< char> > >&)’ first required here
make: *** [y] Error 1
Compilation exited abnormally with code 2 at Fri Dec 18 19:51:35
[/code]
NOTE: this is not for a class, it is a project i've assigned myself for my own amusement.
Comment