本文整理汇总了C++中SS类的典型用法代码示例。如果您正苦于以下问题:C++ SS类的具体用法?C++ SS怎么用?C++ SS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: split_textT
SS split_textT(const typename SS::value_type& src,
const typename SS::value_type& list,
int limit = 0) noexcept
{
SS dst;
bool tab_back = true;
typename SS::value_type word;
for(auto ch : src) {
bool tab = false;
if(limit <= 0 || static_cast<int>(dst.size()) < (limit - 1)) {
if(string_strchr(list, ch)) {
tab = true;
}
}
if(tab_back && !tab && !word.empty()) {
dst.push_back(word);
word.clear();
}
if(!tab) word += ch;
tab_back = tab;
}
if(!word.empty()) {
dst.push_back(word);
}
return dst;
}
示例2: OnButtonOkClick
void FormSet::OnButtonOkClick()
{
SS port = TextPort_.GetText();
if (port.Length() == 0)
{
PopMessage(tcc_("请输入端口号"),800);
TextPort_.SetFocus();
return;
}
df::StringToInteger(port, G::main.listen_port);
G::main.hide_window = choice_[0].GetCheck();
TextPSW_.GetText(port);
if (port.Length() > 0)
{
Sha2Password(port);
G::main.access_psw = std::move(port);
}
G::WriteMainIni();
Close();
}
示例3: calc
void calc(SS& oprs, SD& nums, string& s) {
string opr = oprs.top(); oprs.pop();
if (opr[0] == 'u') s += opr[1];
else s += opr;
s += ' ';
double b = nums.top(); nums.pop();
if (opr[0] == 'u' || (is_func(opr) && opr != "pow")) {
if (opr == "u+") nums.push(b);
else if (opr == "u-") nums.push(-b);
else if (opr == "sin") nums.push(sin(b));
else if (opr == "cos") nums.push(cos(b));
else if (opr == "exp") nums.push(exp(b));
else if (opr == "log") nums.push(log(b));
else if (opr == "sqrt") nums.push(sqrt(b));
else if (opr == "fabs") nums.push(fabs(b));
return;
}
double a = nums.top(); nums.pop();
if (opr == "*") nums.push(a * b);
else if (opr == "+") nums.push(a + b);
else if (opr == "-") nums.push(a - b);
else if (opr == "pow") nums.push(pow(a, b));
}
示例4:
ostream& operator<<(ostream& out, const SS& s) {
VS v;
SS ss = s;
while (!ss.empty()) {
v.PB(ss.top());
ss.pop();
}
for (int i = v.size() - 1; i >= 0; i--)
out << v[i] << ' ';
return out;
}
示例5: add
int PermutationSum::add (int n)
{
SS ss;
ss << n;
ST st;
st = ss.str();
sort(all(st));
cout << ss.str() << endl;
int ret = 0;
do {
ret += atoi(st.c_str());
} while(next_permutation(all(st)));
return ret;
}
示例6: FindVerticalAxesDistance
int BackgroundPrinter::FindVerticalAxesDistance(wxDC *dc, std::vector<Draw*> draws, const SS& sd) {
int d = 0;
for (SS::const_iterator ssi = sd.begin(); ssi != sd.end(); ssi++) {
set<int>::const_iterator si = (*ssi).begin();
if ((*ssi).end() == si)
assert(false);
int di = *si;
Draw *draw = draws[di];
double max = draw->GetDrawInfo()->GetMax();
double min = draw->GetDrawInfo()->GetMin();
wxString maxs = draw->GetDrawInfo()->GetValueStr(max, _T(""));
wxString mins = draw->GetDrawInfo()->GetValueStr(min, _T(""));
wxString unit = draw->GetDrawInfo()->GetUnit();
int maxext, minext, unitext, texth;
dc->GetTextExtent(maxs, &maxext, &texth);
dc->GetTextExtent(mins, &minext, &texth);
dc->GetTextExtent(unit, &unitext, &texth);
int msn = 0;
do {
int tw, th;
dc->GetTextExtent(draws[*si]->GetDrawInfo()->GetUnit(), &tw, &th);
msn = wxMax(msn, tw);
} while (++si != (*ssi).end());
int ext = wxMax(unitext, wxMax(maxext, minext));
ext = wxMax(ext, msn) + line_width;
d = wxMax(d, ext);
}
return d;
}
示例7: main
int main() {
String input;
char c;
while(std::cin >> input) {
Stack s;
SS ss;
unsigned int j = 0;
while(j < input.size() && isprint(c = input[j++])) {
if(c == '[') {
unsigned int k = j;
while(isNormalLetter(c = input[k]))
++k;
if(k == j)
continue;
input[k] = '\0';
s.push(String(&input[j]));
input[k] = c;
j = k;
}
else if(c == ']') {
// nop
}
else {
ss << c;
}
}
// First print Stack, then SS.
while(!s.empty()) {
std::cout << s.top();
s.pop();
}
std::cout << ss.str() << std::endl;
}
}
示例8: converter
template < class T > string converter( T n ){SS x;x << n;return x.str();}
示例9: convtos
string convtos (T a)
{
SS ss;
ss << a;
return ss.str();
}
示例10: teams_template_struct
int teams_template_struct(void) {
SS<int, 123, 456> V;
return V.foo();
}
示例11: play
void play(MSI& rank, VS& toks) {
SS oprs;
SD nums;
string out = "";
char str[100];
cout << "# from infix to postfix!!!" << endl;
for (VS::iterator i = toks.begin(); i != toks.end(); i++) {
string tok = *i;
cout << "There is a " << tok << ": ";
if (is_num(tok)) {
cout << "push to output" << endl;
sprintf(str, "%.6lf ", stod(tok));
out += str;
nums.push(stod(tok));
}
else if (tok == ",") {
cout << "flush the stack until '('" << endl;
while (oprs.top() != "(")
calc(oprs, nums, out);
}
else if (tok == ")") {
cout << "flush the stack until '(' and check if there's a func" << endl;
while (oprs.top() != "(")
calc(oprs, nums, out);
oprs.pop();
if (!oprs.empty() && is_func(oprs.top()))
calc(oprs, nums, out);
}
else {
cout << "push to stack" << endl;
if ( is_unary(tok) && (i == toks.begin() || rank[*(i - 1)] > 0) )
oprs.push("u" + tok);
else {
while (!is_func(tok) && tok != "(" && !oprs.empty() && rank[oprs.top()] <= rank[tok]) {
cout << "\t*** stack.top() has higher precedence" << endl;
calc(oprs, nums, out);
}
oprs.push(tok);
}
}
cout << "\tcurrent output: " << out << endl
<< "\tcurrent stack: " << oprs << endl;
}
while (!oprs.empty())
calc(oprs, nums, out);
cout << "There is nothing left, so flush the stack to output" << endl
<< "\tcurrent output: " << out << endl
<< "#transformation completed!!!" << endl
<< "Postfix Exp: " << out << endl
<< "RESULT: " << nums.top() << endl << endl;
}
示例12: GetDC
bool DrawsPrintout::OnPrintPage(int page) {
if (page != 1)
return false;
int sel = 0;
for (; sel < m_draws_count; ++sel)
if (m_draws[sel]->GetSelected())
break;
if (sel == m_draws_count)
return false;
wxDC *dc = GetDC();
#ifndef MINGW32
try {
wxPostScriptDC *psdc = dynamic_cast<wxPostScriptDC*>(dc);
if (psdc != nullptr)
psdc->PsPrint(_("\n/ISOLatin1Encoding [\n/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/minus/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde/.notdef/.notdef/Lslash/lslash/Nacute/nacute/aogonek/Cacute/cacute/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/dotlessi/grave/acute/Oacute/tilde/macron/breve/dotaccent/Eogonek/eogonek/Sacute/sacute/.notdef/hungarumlaut/ogonek/caron/space/exclamdown/cent/sterling/currency/yen/brokenbar/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot/hyphen/registered/macron/degree/plusminus/twosuperior/oacute/acute/mu/paragraph/periodcentered/.notdef/Zacute/zacute/.notdef/z/onehalf/threequarters/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/Ograve/Oacute/.notdef/.notdef/.notdef/multiply/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/oacute/.notdef/.notdef/.notdef/divide/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n] def\n"));
} catch(...) { // tu ew. usuniecie polskich znakow
}
#endif
wxFont f;
#ifdef __WXMSW__
f.Create(50, wxSWISS, wxNORMAL, wxNORMAL);
#else
f.Create(8, wxSWISS, wxNORMAL, wxNORMAL);
#endif
dc->SetMapMode(wxMM_TEXT);
dc->SetFont(f);
int ppiw, ppih;
GetPPIPrinter(&ppiw, &ppih);
//to milimiters
ppiw /= 25;
ppih /= 25;
int lorigin = Print::page_setup_dialog_data->GetMarginTopLeft().x * ppiw;
int torigin = Print::page_setup_dialog_data->GetMarginTopLeft().y * ppih;
dc->SetDeviceOrigin(lorigin, torigin);
int tw,th;
dc->GetTextExtent(_T("Z"), &tw, &th);
int topmargin, bottommargin, rightmargin;
topmargin = 0;
bottommargin = int(1.4 * th) + Print::page_setup_dialog_data->GetMarginBottomRight().y * ppih;
rightmargin = 10 + Print::page_setup_dialog_data->GetMarginBottomRight().x * ppiw;
SS cd = ChooseDraws();
for (SS::iterator i = cd.begin(); i != cd.end(); i++) {
int tm = (th + line_width) * (i->size() + 1);
if (tm > topmargin)
topmargin = tm;
}
int w, h, pw, ph;
dc->GetSize(&w, &h);
GetPageSizePixels(&pw, &ph);
dc->SetUserScale((float)w / (float)pw, (float)h / (float)ph);
BackgroundPrinter bp(0, rightmargin, topmargin, bottommargin);
bp.SetFont(f);
bp.SetSize(pw - print_left_margin - lorigin, (ph - print_top_margin - torigin) * 2 / 3);
int graph_start = bp.PrintBackground(dc, m_draws, cd);
bp.GetSize(&w, &h);
GraphPrinter gp(
#ifdef __WXGTK__
2,
#else
10,
#endif
graph_start, rightmargin, topmargin, bottommargin);
gp.SetSize(w, h);
gp.SetFont(f);
gp.PrintDraws(dc, m_draws, m_draws_count);
PrintShortDrawNames(&gp, dc);
PrintDrawsInfo(dc, lorigin, torigin, rightmargin, bottommargin);
return true;
}
示例13: main
int main() {
int m, n;
int i, j, k;
int max_subfile, max_file;
string s, x;
//freopen("f:\\in.txt", "r", stdin);
while (cin >> s) {
flist.clear();
for (i=3; s[i]; ++i) {
if (s[i] == '\\') flist.push_back(s.substr(0, i));
}
n = flist.size();
for (i=0; i!=n; ++i) {
if (fc.find(flist[i]) == fc.end()) {
for (j=0; j!=i; ++j) {
if (subfile.find(flist[j]) == subfile.end()) subfile.insert(make_pair(flist[j], 1));
else ++subfile[flist[j]];
}
fc.insert(flist[i]);
}
if (file.find(flist[i]) == file.end()) file.insert(make_pair(flist[i], 1));
else ++file[flist[i]];
}
}
max_subfile = 0, max_file = 0;
for (MSII it=subfile.begin(); it!=subfile.end(); ++it) max_subfile = max(max_subfile, it->second);
for (MSII it=file.begin(); it!=file.end(); ++it) max_file = max(max_file, it->second);
printf("%d %d\n", max_subfile, max_file);
return 0;
}
示例14: main
int main(){
string s1;
int t,n,m,i,j;
ios::sync_with_stdio(0);
while(cin>>t){
for(int ncase=1;ncase<=t;++ncase){
cin>>n>>m;
myset.clear();
while(n--){
cin>>s1;
add(split(s1));
}
cnt=0;
while(m--){
cin>>s1;
solve(split(s1));
}
printf("Case #%d: %d\n",ncase,cnt);
}
}
}
示例15: solve
void solve(SV v){
for(int i=0;i<v.size();++i){
if(!myset.count(v[i]))cnt++;
myset.insert(v[i]);
}
}