P: 2 | I'm a 14 year old student in Singapore. I am doing a programming for my Research Studies in school, I got the source codes of my programme from my mentor in the National University of Singapore Infocomm Research department. However, when I tried to compile the codes, I get the error message that says: 'no matching function for call to `Englingo::addEnglingo(std::vector<int, std::allocator<int> >)' ' The error is in the Englingo.cpp: #include 'Englingo.h' /************************************************** ********************** * * constructor * ************************************************** **********************/ Englingo::Englingo(Utility *utilPtr) { m_putil = utilPtr; } /************************************************** ********************** * * create lingo table from input file * ************************************************** **********************/ void Englingo::createLingoTbl(void) { ifstream inFile('textEnglingo', ios::in); if (!inFile) { cout << 'file opening error: Englingo filen'; } else { while(!inFile.eof()) { addEnglingo(scanSMS2(m_putil->readSMS(inFile))); } } inFile.close(); } /************************************************** ********************** * * enter a pair of lingo into lingo table * ************************************************** **********************/ void Englingo::addEnglingo(vector<int>& tokenArray) { vector<int> tokens; for(int i = 2; i<tokenArray.size(); i++) { tokens.push_back(tokenArray[i]); } m_putil->addLingo(tokenArray[0], m_putil->getCombinedToken(tokens)); } vector<int> Englingo::scanSMS2(const string& message) { vector<int> wordMap; string aToken; int indexS=0, indexE=0, pos=0; while(message[pos]!='0') { // skip space if (isspace(message[pos])) { while(isspace(message[pos])) pos++; // punctuations token except ' } else if ((ispunct(message[pos]))&&(message[pos]!='')) { indexS = pos; while(ispunct(message[pos])) pos++; indexE = pos; aToken = message.substr(indexS, indexE-indexS); wordMap.push_back(m_putil->insertVocab(aToken)); } //texts token and ' and unknow chars else { indexS = pos; while(!(isspace(message[pos]))&&!(ispunct(message[pos])) &&(message[pos]!=0)&&(message[pos]!= EOF) (message[pos]'')) pos++; indexE = pos; aToken = message.substr(indexS, indexE-indexS); m_putil->toLowerCase(aToken); wordMap.push_back(m_putil->insertVocab(aToken)); } } return wordMap; } I have also included the Englingo.h and Utility.h needed for this cpp file, as well as the compiler log. Englingo.h: #ifndef ENGLINGO_H #define ENGLINGO_H #include <Utility.h> using namespace std; class Englingo { public: Englingo(Utility*); void createLingoTbl(void); private: void addEnglingo(vector<int>& tokenArray); vector<int> scanSMS2(const string& message); Utility* m_putil; }; #endif Utility.h: #ifndef UTILITY_H #define UTILITY_H #include <iostream> #include <vector> #include <map> #include <string> #include <fstream> #include <algorithm> #define MAX_OFFSET 5 using namespace std; class Utility { public: typedef struct { vector<int> rawSMS; vector<int> norSMS; } TextPair; typedef struct { int rawIndex; int norIndex; } IndexPair; typedef map<string, int> VocabTable; typedef map<int, int> LingoTable; Utility(); string readSMS(ifstream& ifs); void scanSMS(const string& message, vector<int>& tkArray); int getCombinedToken(vector<int> tokens); vector<string> splitStr(const string& str); vector<int> splitToken(int tokenID); string trimStr(const string& rawStr); int toLowerCase(int tokenID); void toLowerCase(string& token); int getVocabID(string vocab); string lookupVocab(int vocabID); int insertVocab(string word); bool compareTokens(int rTokenID, int nTokenID); bool hasMatchToken(const Utility::TextPair& textPair, Utility::IndexPair low, Utility::IndexPair& high); void addLingo(int frontID, int lingoID); vector<int> lookupLingo(int tokenID); bool hasLingo(const Utility::TextPair& textPair, Utility::IndexPair low, vector<int>& lingo); private: bool checkFollowedTokens(const Utility::TextPair& textPair, int rIndex, int nIndex, int nBegin); bool compareNextBoundary(const Utility::TextPair& textPair, int rIndex, int nIndex, int nBegin); bool compareSimilarity(const Utility::TextPair& textPair, int rIndex, int nIndex, int nBegin); bool compareLingo(const Utility::TextPair& textPair, int rIndex, int nBegin); bool compareLingoTokens(const Utility::TextPair& textPair, const vector<int>& tokens, int nBegin); bool compareMultiLingoTokens(const Utility::TextPair& textPair, vector<int>& tokens, int nBegin); void copyLingo(vector<int>& lingo, const vector<int>& sepTokens); static int m_wordUID; VocabTable m_vocabTable; vector<string> m_vocabList; LingoTable m_lingoTable; }; bool space(char c); bool notSpace(char c); #endif Compiler Log: Compiler: Default compiler Building Makefile: 'E:YukiResearch StudiesTrainingMakefile.win' Executing make. make.exe -f 'E:YukiResearch StudiesTrainingMakefile.win' all g++.exe -c Englingo.cpp -o Englingo.o -I'E:/Yuki/Dev-Cpp/lib/gcc/mingw32/3.4.2/include' -I'E:/Yuki/Dev-Cpp/include/c++/3.4.2/backward' -I'E:/Yuki/Dev-Cpp/include/c++/3.4.2/mingw32' -I'E:/Yuki/Dev-Cpp/include/c++/3.4.2' -I'E:/Yuki/Dev-Cpp/include' -I'E:/Yuki/Research Studies/Training' -I'E:/Yuki/Research Studies' -D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_CONSOLE -D_MBCS Englingo.cpp: In member function `void Englingo::createLingoTbl()': Englingo.cpp:28: error: no matching function for call to `Englingo::addEnglingo(std::vector<int, std::allocator<int> >)' Englingo.h:18: note: candidates are: void Englingo::addEnglingo(std::vector<int, std::allocator<int> >&) Englingo.cpp: In member function `void Englingo::addEnglingo(std::vector<int, std::allocator<int> >&)': Englingo.cpp:45: warning: comparison between signed and unsigned integer expressions make.exe: *** [Englingo.o] Error 1 Execution terminated Can anyone help me please? |
|
isalnum, isalpha, isascii, isblank, iscntrl, isdigit, isgraph, islower,isprint, ispunct, isspace, isupper, isxdigit,isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l,isdigit_l, isgraph_l, islower_l,isprint_l, ispunct_l, isspace_l, isupper_l, isxdigit_l- character classification functions
Synopsis
Sep 13, 2017 isspace in C/C and its application to count whitespace characters. Isspace function In C, isspace is a predefined function used for string and character handling.cstring is the header file required for string functions and cctype. Find answers to c ispunct from the expert community at Experts Exchange.
Feature Test Macro Requirements for glibc (seefeature_test_macros(7)):
isascii():
- In this article, we are going to learn about the use ispunct function of ctype.h header file in C language, and use it to check punctuation marks. Submitted by Manu Jemini, on April 04, 2018. We can use a simple function to check a character if it’s punctuation or not.
- The C standard library provides a large number of library functions (under different header files) for performing common tasks.
- #include using std::cout; using std::endl; #include using std::iscntrl; using std::isgraph; using std::isprint; using std::ispunct; using std.
- The ispunct function returns non-zero if its argument is a printing character but neither alphanumeric nor a space. Otherwise, zero is returned. Related topics isalnum - isalpha - iscntrl - isdigit - isgraph - isspace - isxdigit.
- _XOPEN_SOURCE >= 600 _ISOC99_SOURCE _POSIX_C_SOURCE >= 200112L;
orcc -std=c99
isalnum_l(),isalpha_l(),isblank_l(),iscntrl_l(),isdigit_l(),isgraph_l(),islower_l(),isprint_l(),ispunct_l(),isspace_l(),isupper_l(),isxdigit_l():
- Since glibc 2.10:
- _XOPEN_SOURCE >= 700
- Before glibc 2.10:
- _GNU_SOURCE
isascii_l():
- Since glibc 2.10:
- _XOPEN_SOURCE >= 700 && (_SVID_SOURCE _BSD_SOURCE)
- Before glibc 2.10:
- _GNU_SOURCE
Description
These functions check whether
c,which must have the value of an
unsigned charor
EOF,falls into a certain character class according to the specified locale.The functions without the'_l' suffix perform the check based on the current locale.
The functions with the '_l' suffix perform the checkbased on the locale specified by the locale objectlocale.The behavior of these functions is undefined iflocaleis the special locale objectLC_GLOBAL_LOCALE(seeduplocale(3))or is not a valid locale object handle.
The list below explains the operation of the functions withoutthe '_l' suffix;the functions with the '_l' suffix differ only in using the locale objectlocaleinstead of the current locale.
locale, it is equivalent to
(isupper(c) islower(c)).In some locales, there may be additional characters for which
isalpha()is true---letters which are neither uppercase nor lowercase.
isascii()checks whether c is a 7-bitunsigned charvalue that fits intothe ASCII character set.isblank()checks for a blank character; that is, a space or a tab.iscntrl()checks for a control character.isdigit()checks for a digit (0 through 9).isgraph()checks for any printable character except space.islower()checks for a lowercase character.isprint()checks for any printable character including space.ispunct()checks for any printable character which is not a space or analphanumeric character.isspace()checks for white-space characters.In theCandPOSIXlocales, these are: space, form-feed(aqfaq),newline(aqnaq),carriage return(aqraq),horizontal tab(aqtaq),and vertical tab(aqvaq).isupper()checks for an uppercase letter.isxdigit()checks for hexadecimal digits, that is, one of
0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F. Return Value
The values returned are nonzero if the charactercfalls into the tested class, and zero if not.
Attributes
Multithreading (see pthreads(7))
Theisalnum(),isalpha(),isascii(),isblank(),iscntrl(),isdigit(),isgraph(),islower(),isprint(),ispunct(),isspace(),isupper(),andisxdigit()functions are thread-safe.
Versions
isalnum_l(),isalpha_l(),isblank_l(),iscntrl_l(),isdigit_l(),isgraph_l(),islower_l(),isprint_l(),ispunct_l(),isspace_l(),isupper_l(),isxdigit_l(),andisascii_l()are available since glibc 2.3.
Conforming To
Ispunct Dev C 5
C89 specifies
isalnum(),
isalpha(),
iscntrl(),
isdigit(),
isgraph(),
islower(),
isprint(),
ispunct(),
isspace(),
isupper(),and
isxdigit(),but not
isascii()and
isblank().POSIX.1-2001also specifies those functions, and also
isascii()(as an XSI extension)and
Ispunct Dev C Download
isblank().C99 specifies all of the preceding functions, except
isasciiIspunct Dev C 4
().
POSIX.1-2008 marksisasciiCant download from app store mac. ()as obsolete,noting that it cannot be used portably in a localized application.
POSIX.1-2008 specifiesisalnum_l(),isalpha_l(),isblank_l(),iscntrl_l(),isdigit_l(),isgraph_l(),islower_l(),isprint_l(),ispunct_l(),isspace_l(),isupper_l(),andisxdigit_l/auto-tune-evo-vst-pour-audacity.html. ().
isascii_l()is a GNU extension.
Notes
The details of what characters belong to which class depend on thelocale.For example,isupper()will not recognize an A-umlaut (:A) as an uppercase letter in the defaultClocale.
See Also
iswalnum(3),iswalpha(3),iswblank(3),iswcntrl(3),iswdigit(3),iswgraph(3),iswlower(3),iswprint(3),iswpunct(3),iswspace(3),iswupper(3),iswxdigit(3),newlocale(3),setlocale(3),uselocale(3),toascii(3),tolower(3),toupper(3),ascii(7),locale(7)
Colophon
Dev C++ Download For Windows 7
This page is part of release 3.80 of the Linuxman-pagesproject.A description of the project,information about reporting bugs,and the latest version of this page,can be found athttp://www.kernel.org/doc/man-pages/.
Dev C++ Online
License & Copyright