Changeset 3733643
- Timestamp:
- Sep 13, 2024, 8:29:50 AM (2 months ago)
- Branches:
- master
- Children:
- 9739c56f, dcfcf368
- Parents:
- 2ac78a1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/uC++toCFA/uC++toCFA.tex
r2ac78a1 r3733643 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Sat Apr 13 11:11:39202414 %% Update Count : 59 6913 %% Last Modified On : Fri Sep 13 07:48:54 2024 14 %% Update Count : 5987 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 154 154 \begin{tabular}{@{}l|l@{}} 155 155 \multicolumn{2}{@{}l}{\lstinline{ int x = 1, y = 2, * p1x = &x, * p1y = &y, ** p2i = &p1x,}} \\ 156 \multicolumn{2}{@{}l}{\lstinline{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ & &r1x = x, & r1y = y, && r2i = r1x;}} \\156 \multicolumn{2}{@{}l}{\lstinline{\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ & r1x = x, & r1y = y, && r2i = r1x;}} \\ 157 157 \begin{uC++} 158 158 **p2i = 3; … … 384 384 \multicolumn{2}{@{}l@{}}{\lstinline{string s1, s2;}} \\ 385 385 \begin{uC++} 386 s1 = " hi";386 s1 = "abcdefg"; 387 387 s2 = s1; 388 388 s1 += s2; … … 393 393 s1.substr( 2 ); s1.substr( 2, 3 ); 394 394 s1.replace( 2, 5, s2 ); 395 s1.find( s2 ) ,s1.rfind( s2 );395 s1.find( s2 ); s1.rfind( s2 ); 396 396 s1.find_first_of( s2 ); s1.find_last_of( s2 ); 397 s1.find_first_not_of( s2 ); s1.find_last_not_of( s2 );397 s1.find_first_not_of( s2 ); s1.find_last_not_of( s2 ); 398 398 getline( cin, s1 ); 399 399 cout << s1 << endl; … … 401 401 & 402 402 \begin{cfa} 403 s1 = " hi";403 s1 = "abcdefg"; 404 404 s2 = s1; 405 405 s1 += s2; … … 409 409 s1[3]; 410 410 s1( 2 ); s1( 2, 3 ); 411 // s1.replace(2, 5, s2 );412 find( s1, s2 ), rfind( s1, s2 );413 find_first_of( .substr, s2 ); s1.find_last_of( s2 );414 s1.find_first_not_of(s2 ); s1.find_last_not_of(s2 );411 // replace( s1, 2, 5, s2 ); 412 // find( s1, s2 ), rfind( s1, s2 ); 413 // find_first_of( s2 ); find_last_of( s2 ); 414 // find_first_not_of( s1, s2 ); find_last_not_of( s1, s2 ); 415 415 sin | getline( s1 ); 416 416 sout | s1; … … 451 451 452 452 453 \section{\texorpdfstring{\lstinline{u NoCtor}}{uNoCtor}}453 \section{\texorpdfstring{\lstinline{uArray}}{uArray}} 454 454 455 455 \begin{cquote} 456 456 \begin{tabular}{@{}l|l@{}} 457 457 \begin{uC++} 458 458 #include <iostream> 459 using namespace std; 459 460 struct S { 460 461 int i; … … 464 465 int main() { 465 466 enum { N = 5 }; 466 @u NoCtor<S>@ s[N];// no constructor calls467 for ( int i = 0; i < N; i += 1 ) @s[i] .ctor( i )@;467 @uArray( S, s, N );@ // no constructor calls 468 for ( int i = 0; i < N; i += 1 ) @s[i]( i )@; // constructor calls 468 469 for ( int i = 0; i < N; i += 1 ) cout << s[i]@->@i << endl; 469 470 } … … 471 472 & 472 473 \begin{cfa} 473 #include @<raii.hfa>@ // uninit 474 #include <fstream.hfa> 475 #include <array.hfa> 474 476 struct S { 475 477 int i; … … 479 481 int main() { 480 482 enum { N = 5 }; 481 @ uninit(S)@ s[N];// no constructor calls482 for ( i; N ) @s[i]{ i }@; 483 @array( S, N ) s = { delay_init };@ // no constructor calls 484 for ( i; N ) @s[i]{ i }@; // constructor calls 483 485 for ( i; N ) sout | s[i]@.@i; 484 486 } … … 522 524 \end{cfa} 523 525 \\ 524 \multicolumn{2}{ l}{\lstinline{C c;}}526 \multicolumn{2}{@{}l@{}}{\lstinline{C c;}} 525 527 \end{tabular} 526 528 \end{cquote} … … 594 596 \end{cfa} 595 597 \\ 596 \multicolumn{2}{ l}{\lstinline{M m;}}598 \multicolumn{2}{@{}l@{}}{\lstinline{M m;}} 597 599 \end{tabular} 598 600 \end{cquote} … … 625 627 \end{cfa} 626 628 \\ 627 \multicolumn{2}{ l}{\lstinline{T t; // start thread in main routine}}629 \multicolumn{2}{@{}l@{}}{\lstinline{T t; // start thread in main routine}} 628 630 \end{tabular} 629 631 \end{cquote}
Note: See TracChangeset
for help on using the changeset viewer.