#if 0 # keithhedger Wed 20 Dec 16:18:20 GMT 2023 kdhedger68713@gmail.com pushd .. make -j3 popd if [[ $USEVALGRIND -eq 1 ]];then VALGRIND="valgrind --leak-check=full" fi if [[ $USEVALGRIND -eq 2 ]];then VALGRIND="valgrind --leak-check=full --show-leak-kinds=all" fi APPNAME=$(basename $0 .cpp) g++ "$0" -O0 -ggdb -I../LFSToolKit -L../LFSToolKit/app/.libs $(pkg-config --cflags --libs x11 xft cairo ) -llfstoolkit -lImlib2 -o $APPNAME||exit 1 LD_LIBRARY_PATH=../LFSToolKit/app/.libs $VALGRIND ./$APPNAME "$@" retval=$? echo "Exit code $retval" rm $APPNAME exit $retval #endif #include #include #include #include #include "lfstk/LFSTKGlobals.h" #include #include #include #include #include //#include #include std::string LFSTK_oneLinerStd(const std::string fmt,...) { va_list ap; va_start(ap, fmt); std::string str=""; int fmtcnt=0; while(fmtcnt(c) << '\n'; } else if (*fmt == 'f') { double d = va_arg(args, double); std::cout << d << '\n'; } else if (*fmt == 's') { std::string st = va_arg(args, std::string); std::cout << st << '\n'; } ++fmt; } va_end(args); } template void foo_print(Ts... args) { fprintf(stderr,"arg=%p\n",((args),...)); ((std::cout << args << ' '), ...); } template std::string foo_print2(Ts1... args) { //std::cout << ((args[1]),...); std::string s;//=((args),...); std::stringstream ss; ((ss << args ), ...); return(ss.str()); // ((std::cout << args << ' '), ...); } int main(int argc, char **argv) { std::cout << std::boolalpha; std::cout << std::noskipws; std::string str=argv[1]; foo_print(1, 3.14f, "\n"); // 1 3.14 foo_print("Foo", 'b', true, nullptr,"\n",str, "\n"); // Foo b true nullptr str=str+"foobar\n"; foo_print("\n\n",str); std::string arg1="/etc/fstab"; std::string x=foo_print2("cp ",arg1," ","/tmp"); std::cerr<<">>"<>"<>"<