A size-optimized STL implementation.

uSTL

This library is obsolete. Please use the official gcc C++ standard library.

uSTL is a partial implementation of the C++ standard library that focuses on decreasing the memory footprint of user executables. While some projects can use it to replace the standard library without any code changes, there exist important differences that you should be aware of. Please read documentation in docs/index.html before using this library in your project.

The only dependency is a C++ compiler, gcc 3.4 or clang 3.2. C++14 support requires gcc 5 or clang 3.6. Build configuration is in Config.mk and config.h, generated by configure. configure --help will list available configuration options.

./configure --prefix=/usr
make
make check
make install

Report bugs on the github issue tracker

Comments
  • Can't build ustl on OS X Yosemite

    Can't build ustl on OS X Yosemite

    Hello ! I'm trying to build ustl on OS X Yosemite and the configure script do not give any error but the generated files are not completely transformed and it doesn't compile:

    ################ Build options #######################################
    
    NAME        := ustl
    MAJOR       := 2
    MINOR       := 2
    
    #DEBUG      := 1
    BUILD_SHARED    := 1
    #BUILD_STATIC   := 1
    NOLIBSTDCPP := 1
    
    ################ Programs ############################################
    
    CXX     := g++
    LD      := g++
    AR      := ar
    RANLIB      := ranlib
    DOXYGEN     := doxygen
    INSTALL     := install
    
    INSTALLDATA := ${INSTALL} -D -p -m 644
    INSTALLLIB  := ${INSTALLDATA}
    RMPATH      := rmdir -p --ignore-fail-on-non-empty
    
    ################ Destination #########################################
    
    INCDIR      := /usr/local/include
    LIBDIR      := /usr/local/lib
    
    ################ Compiler options ####################################
    
    WARNOPTS    := -Wall -Wextra -Woverloaded-virtual -Wpointer-arith\
            -Wshadow -Wredundant-decls -Wcast-qual -Wno-long-double
    TGTOPTS     := @[email protected] @[email protected]
    INLINEOPTS  := @[email protected]
    
    CXXFLAGS    := ${WARNOPTS} ${TGTOPTS} -fPIC
    LDFLAGS     := @[email protected]
    LIBS        :=
    ifdef DEBUG
        CXXFLAGS    += -O0 -g
        LDFLAGS += -rdynamic
    else
        CXXFLAGS    += -Os -g0 -DNDEBUG=1 -fomit-frame-pointer ${INLINEOPTS}
        LDFLAGS += -s -Wl,-gc-sections
    endif
    ifdef NOLIBSTDCPP
        LD      := /usr/bin/gcc
        STAL_LIBS   := @[email protected] @[email protected] @[email protected]
        LIBS    := ${STAL_LIBS}
    endif
    BUILDDIR    := /tmp/xxxx/make/${NAME}
    O       := .o/
    
    slib_lnk    = lib$1.dylib
    slib_son    = lib$1.dylib.${MAJOR}
    slib_tgt    = lib$1.dylib.${MAJOR}.${MINOR}
    slib_flags  = -Wl,-single_module -compatibility_version 1 -current_version 1 -install_name $1 -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.4
    
    

    Output of config.sed:

    cat config.sed 
    s/ \[email protected][email protected]//g
    s/ \[email protected][email protected]//g
    s/#undef \(HAVE_LONG_LONG\)/#define \1 1/g
    s/#undef \(SIZE_OF_LONG_LONG\)/#define \1 8/g
    s/#undef \(SIZE_T_IS_LONG\)/#define \1 1/g
    s/#undef \(HAVE_VECTOR_EXTENSIONS\)/#define \1 1/g
    s/@[email protected]/LITTLE_ENDIAN/g
    s/#undef \(RETSIGTYPE\)/#define \1 void/g
    s/#undef const/\/\* #define const \*\//g
    s/#undef inline/\/\* #define inline __inline \*\//g
    s/#undef off_t/\/\* typedef long off_t; \*\//g
    s/#undef size_t/\/\* typedef long size_t; \*\//g
    s/#undef \(SIZE_OF_CHAR\)/#define \1 1/g
    s/#undef \(SIZE_OF_SHORT\)/#define \1 2/g
    s/#undef \(SIZE_OF_INT\)/#define \1 4/g
    s/#undef \(SIZE_OF_LONG\)/#define \1 8/g
    s/#undef \(SIZE_OF_POINTER\)/#define \1 8/g
    s/#undef \(SIZE_OF_SIZE_T\)/#define \1 8/g
    s/#undef \(LSTAT_FOLLOWS_SLASHED_SYMLINK\)/#define \1 1/g
    s/ \[email protected][email protected]/ -std=c++11 -march=native/g
    s/#undef \(HAVE_THREE_CHAR_TYPES\)/#define \1 1/g
    s/ \[email protected][email protected]//g
        s/@[email protected]/-Wno-long-double/g
        s/lib$1.so/lib$1.dylib/g
        s/lib$1.so.${MAJOR}.${MINOR}.${BUILD}/lib$1.${MAJOR}.${MINOR}.${BUILD}.dylib/g
        s/lib$1.so.${MAJOR}.${MINOR}/lib$1.${MAJOR}.${MINOR}.dylib/g
        s/lib$1.so.${MAJOR}/lib$1.${MAJOR}.dylib/g
        s/@[email protected]/-Wl,-single_module -compatibility_version 1 -current_version 1 -install_name $1 -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.4/g
    s/#undef \(SIZE_OF_BOOL\)/#define \1 SIZE_OF_LONG/g
    s/ \?-mfpmath=sse//g
    s/#define \(HAVE_STRSIGNAL\) 1/#undef \1/g
    s/@[email protected]/\/usr\/local/g
    s/@[email protected]/\/usr\/local\/bin/g
    s/@[email protected]/\/usr\/local\/share/g
    s/@[email protected]/\/usr\/local\/etc/g
    s/@[email protected]/\/usr\/local\/var/g
    s/@[email protected]/\/usr\/local\/include/g
    s/@[email protected]/\/usr\/include/g
    s/@[email protected]/\/usr\/local\/share\/doc\/ustl/g
    s/@[email protected]/\/usr\/local\/lib/g
    s/@[email protected]/\/locale/g
    s/@[email protected]/\/man/g
    s/@[email protected]/\/tmp\/mingo\/make/g
    s/@[email protected]/\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/..\/lib\/clang\/6.1.0\/include/g
    s/@[email protected]/\/Applications\/Xcode.app\/Contents\/Developer\/Toolchains\/XcodeDefault.xctoolchain\/usr\/bin\/..\/lib\/clang\/6.1.0\/lib/g
    s/@[email protected]/\/usr\/local\/include/g
    s/@[email protected]/\/usr\/local\/lib/g
    s/ \[email protected]@//g;s/ \[email protected]@//g
    s/#undef \(HAVE_ASSERT_H\)/#define \1 1/
    s/#undef \(HAVE_CTYPE_H\)/#define \1 1/
    s/#undef \(HAVE_ERRNO_H\)/#define \1 1/
    s/#undef \(HAVE_FCNTL_H\)/#define \1 1/
    s/#undef \(HAVE_FLOAT_H\)/#define \1 1/
    s/#undef \(HAVE_INTTYPES_H\)/#define \1 1/
    s/#undef \(HAVE_LIMITS_H\)/#define \1 1/
    s/#undef \(HAVE_STDIO_H\)/#define \1 1/
    s/#undef \(HAVE_LOCALE_H\)/#define \1 1/
    s/#undef \(HAVE_ALLOCA_H\)/#define \1 1/
    s/#undef \(HAVE_SIGNAL_H\)/#define \1 1/
    s/#undef \(HAVE_STDARG_H\)/#define \1 1/
    s/#undef \(HAVE_STDDEF_H\)/#define \1 1/
    s/#undef \(HAVE_SYS_STAT_H\)/#define \1 1/
    s/#undef \(HAVE_SYS_TYPES_H\)/#define \1 1/
    s/#undef \(HAVE_STDINT_H\)/#define \1 1/
    s/#undef \(HAVE_STDLIB_H\)/#define \1 1/
    s/#undef \(HAVE_STRING_H\)/#define \1 1/
    s/#undef \(HAVE_TIME_H\)/#define \1 1/
    s/#undef \(HAVE_UNISTD_H\)/#define \1 1/
    s/#undef \(HAVE_MATH_H\)/#define \1 1/
    s/#undef \(HAVE_STDLIB_H\)/#define \1 1/
    s/#undef \(HAVE_SYS_MMAN_H\)/#define \1 1/
    s/#undef \(HAVE_EXECINFO_H\)/#define \1 1/
    s/ \[email protected][email protected]//g
    s/ \[email protected][email protected]//g
    s/ \[email protected]@//g
    s/@[email protected]/\/usr\/bin\/gcc/g
    s/@[email protected]/gcc/g
    s/@[email protected]/\/usr\/bin\/gcc/g
    s/@[email protected]/clang/g
    s/@[email protected]/\/usr\/bin\/gcc/g
    s/@[email protected]/cc/g
    s/@[email protected]/g++/g
    s/@[email protected]/clang++/g
    s/@[email protected]/c++/g
    s/@[email protected]/doxygen/g
    s/@[email protected]/ld/g
    s/@[email protected]/ar/g
    s/@[email protected]/ranlib/g
    s/@[email protected]/touch/g
    s/@[email protected]/install/g
    s/@[email protected]/gcc/g
    s/@[email protected]/clang/g
    s/@[email protected]/cc/g
    s/@[email protected]/g++/g
    s/@[email protected]/clang++/g
    s/@[email protected]/c++/g
    s/@[email protected]/doxygen/g
    s/@[email protected]/ld/g
    s/@[email protected]/ar/g
    s/@[email protected]/ranlib/g
    s/@[email protected]/touch/g
    s/@[email protected]/install/g
    s/ \[email protected]@//g
    s/ \[email protected]@//g
    s/@[email protected]/ustl/g
    s/@[email protected]/0x220/g
    s/@[email protected]/v2.2-20-ge808197/g
    s/@[email protected]/ustl v2.2-20-ge808197/g
    s/@[email protected]/USTL/g
    s/@[email protected]/Mike Sharov <[email protected]>/g
    s/@[email protected]/2/g
    s/@[email protected]/2/g
    

    The compiler:

    gcc -v
    Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
    Target: x86_64-apple-darwin14.5.0
    Thread model: posix
    

    Cheers !

  • shared_ptr any reason to not have it ?

    shared_ptr any reason to not have it ?

    Hello ! I noticed that ustl do not have a shared_ptr implementation, any reason for that ? Then the next question would be atomic and threads ?

    Cheers !

  • [GCC12] build warning and issues

    [GCC12] build warning and issues

    I have been trying to (re-)build the repository HEAD in recent GCC version.

    $ gcc --version
    gcc (GCC) 12.0.1 20220205 (Red Hat 12.0.1-0)
    

    There are some warnings during build:

    echo "    Compiling ustring.cc ..."
        Compiling ustring.cc ...
    g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -MMD -MT "ustring.s .o/ustring.o" -o .o/ustring.o -c ustring.cc
    ustring.cc: In member function 'ustl::string::read(ustl::istream&)':
    ustring.cc:360:44: warning: 'szbuf' may be used uninitialized [-Wmaybe-uninitialized]
      360 |     size_t szsz (Utf8SequenceBytes (szbuf[0]) - 1), n = 0;
          |                                     ~~~~~~~^
    ustring.cc:358:10: note: 'szbuf' declared here
      358 |     char szbuf [8];
          |          ^~~~~
    echo "    Compiling ustdxept.cc ..."
        Compiling ustdxept.cc ...
    g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -MMD -MT "ustdxept.s .o/ustdxept.o" -o .o/ustdxept.o -c ustdxept.cc
    ustdxept.cc: In member function 'ustl::file_exception::file_exception(char const*, char const*)':
    ustdxept.cc:104:17: warning: 'strncpy' specified bound 4096 equals destination size [-Wstringop-truncation]
      104 |         strncpy (_filename, filename, VectorSize(_filename));
          |                 ^
    echo "Linking libustl.a ..."
    Linking libustl.a ...
    

    And a build error in testing suite:

    echo "    Compiling test/stdtest.cc ..."
        Compiling test/stdtest.cc ...
    g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -MMD -MT "test/stdtest.s .o/test/stdtest.o" -o .o/test/stdtest.o -c test/stdtest.cc
    test/stdtest.cc: In function 'void InstallCleanupHandlers()':
    test/stdtest.cc:55:10: warning: 'void (* std::set_unexpected(unexpected_handler))()' is deprecated [-Wdeprecated-declarations]
       55 |     std::set_unexpected (OnUnexpected);
          |          ^~~~~~~~~~~~~~
    In file included from test/../utypes.h:34,
                     from test/../uutility.h:10,
                     from test/../ualgobase.h:7,
                     from test/../cmemlink.h:7,
                     from test/../memlink.h:7,
                     from test/../memblock.h:7,
                     from test/../uvector.h:7,
                     from test/../uspecial.h:7,
                     from test/stdtest.h:7,
                     from test/stdtest.cc:9:
    /usr/include/c++/12/exception:91:22: note: declared here
       91 |   unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT;
          |                      ^~~~~~~~~~~~~~
    test/stdtest.cc:55:25: warning: 'void (* std::set_unexpected(unexpected_handler))()' is deprecated [-Wdeprecated-declarations]
       55 |     std::set_unexpected (OnUnexpected);
          |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
    /usr/include/c++/12/exception:91:22: note: declared here
       91 |   unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT;
          |                      ^~~~~~~~~~~~~~
    Linking .o/test/algos ...
    echo "    Compiling test/array.cc ..."
        Compiling test/array.cc ...
    g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -MMD -MT "test/array.s .o/test/array.o" -o .o/test/array.o -c test/array.cc
    Linking .o/test/array ...
    ualgobase.cc: Assembler messages:
    ualgobase.cc:175: Error: operand type mismatch for `movd'
    ualgobase.cc:169: Error: operand type mismatch for `movd'
    make[1]: *** [/tmp/ccFApUSl.mk:2: /tmp/ccV0kgtt.ltrans0.ltrans.o] Error 1
    lto-wrapper: fatal error: make returned 2 exit status
    compilation terminated.
    /usr/bin/ld: error: lto-wrapper failed
    collect2: error: ld returned 1 exit status
    make: *** [test/Module.mk:33: .o/test/array] Error 1
    
  • build ustl with clang on Linux

    build ustl with clang on Linux

    Hi,

    On Ubuntu 14.04 (clang 3.4, gcc 4.8.4) and Fedora 22 (clang 3.5, gcc 5.3.1): CC=clang CXX=clang++ ./configure --libdir=path/to/libsupc++.a (without --libdir it searches for libcxxabi when CC=clang) make works fine, make check however shows quite a few diffs.

    Is such configuration supposed to work? Thanks!

  • istringstream read bool does not treat EOF as a non-read delimiter

    istringstream read bool does not treat EOF as a non-read delimiter

    please add / extend more sense for your point of view (sorry about reopen if it harms you side) i agree that ustl::istringstream can't/should't contain any failbits in this case but i also agree with the same interface and behavior between std and ustl (please fix me if i'm wrong)

    my latest comment at #73 mentions that i had retested original case without adding eof() to result.

    it is checking only fail() result;

    std:

    [email protected]:/home$ clang++ istrm.cpp -o istrm.clang++.std.x -I ../COMMON/ [email protected]:/home$ ./istrm.clang++.std.x passed: "false", actual result: '0', expected result: '0', logical complete result: 1 passed: "true", actual result: '1', expected result: '1', logical complete result: 1

    ustl:

    [email protected]:/home$ clang++ istrm.cpp -o istrm.clang++.ustl.x -I ../COMMON/ -DUSE_USTL -lustl [email protected]:/home$ ./istrm.clang++.ustl.x passed: "false", actual result: '0', expected result: '0', logical complete result: 0 passed: "true", actual result: '1', expected result: '1', logical complete result: 0

    invalid "logical complete" result blocks trusting to ">> operation" from user side. so as a workaround user has to convert "actual result" vise-versa to a temporary string again to do a custom check of convertion

    g++ has the same results

    please take a look at attachment istrm.cpp.txt

  • std::nullptr_t, std::is_constructible, ...

    std::nullptr_t, std::is_constructible, ...

    Hello ! I'm trying to use https://github.com/dropbox/json11 with ustl and it uses several c++11 features that are not implemented in ustl how is your suggestion to this (mix ustl and std, implement then in ustl) ?

    std::nullptr_t std::is_constructible std::is_trivially_constructible std::is_nothrow_constructible ... Cheers !

  • string::erase overload bug ?

    string::erase overload bug ?

    Hello !

    I'm testing ustl on https://github.com/titi38/libnavajo and one of the errors I'm getting is this one:

    #include <ustl.h>
    using namespace ustl;
    
    int main()
    {
        string str = "Hello world!";
        str.erase(0,1);
        cout << str << endl;
        return 0;
    }
    
    ||=== Build: Debug in test (compiler: GNU GCC Compiler) ===|
    main.cpp||In function ‘int main()’:|
    main.cpp|7|error: call of overloaded ‘erase(int, int)’ is ambiguous|
    main.cpp|7|note: candidates are:|
    ../../../../../../local/include/ustl/ustring.h|163|note: ustl::string::value_type* ustl::string::erase(ustl::string::const_iterator, ustl::cmemlink::size_type)|
    ../../../../../../local/include/ustl/ustring.h|164|note: ustl::string& ustl::string::erase(ustl::cmemlink::size_type, ustl::cmemlink::size_type)|
    ../../../../../../local/include/ustl/ustring.h|165|note: ustl::string::value_type* ustl::string::erase(ustl::string::const_iterator, ustl::string::const_iterator) <near match>|
    ../../../../../../local/include/ustl/ustring.h|165|note:   no known conversion for argument 2 from ‘int’ to ‘ustl::string::const_iterator {aka const char*}’|
    
    
  • Linking on Fedora 22

    Linking on Fedora 22

    After figuring out that Debian based distributions aren't supported out of the box without some workarounds I installed Fedora 22 in a VM. I installed the ustl as advised in the documentation. (In the end I would like to use a different prefix, however at first I just wanted to get it working.) With this setup compiling the hello world example from the doc works fine, however I can't get it to link properly.

    [[email protected] ~]$ gcc -lustl main.cpp /usr/local/lib/libustl.so: undefined reference to __cxa_end_catch' /usr/local/lib/libustl.so: undefined reference to__cxa_allocate_exception' /usr/local/lib/libustl.so: undefined reference to typeinfo for unsigned char' /usr/local/lib/libustl.so: undefined reference totypeinfo for long' /usr/local/lib/libustl.so: undefined reference to typeinfo for unsigned int' /usr/local/lib/libustl.so: undefined reference totypeinfo for char const*' /usr/local/lib/libustl.so: undefined reference to __gxx_personality_v0' /usr/local/lib/libustl.so: undefined reference to__cxa_begin_catch' /usr/local/lib/libustl.so: undefined reference to __cxa_throw' /usr/local/lib/libustl.so: undefined reference tovtable for __cxxabiv1::__si_class_type_info' /usr/local/lib/libustl.so: undefined reference to typeinfo for unsigned long' /usr/local/lib/libustl.so: undefined reference totypeinfo for char' /usr/local/lib/libustl.so: undefined reference to vtable for __cxxabiv1::__class_type_info' /usr/local/lib/libustl.so: undefined reference tovtable for __cxxabiv1::__vmi_class_type_info' collect2: Fehler: ld gab 1 als Ende-Status zurück

  • STDUNIX_HEADERS not set on Debian?

    STDUNIX_HEADERS not set on Debian?

    Hi,

    I tried ustl v2.2 on Debian (8.0). ./configure ran fine, but make got me this error:

    ustl-2.2$ make
        Compiling sostream.cc ...
    In file included from uutility.h:10:0,
                     from ualgobase.h:7,
                     from cmemlink.h:7,
                     from memlink.h:7,
                     from mistream.h:7,
                     from sostream.cc:6:
    utypes.h:12:6: error: #error "This library compiles only on UNIX systems."
         #error "This library compiles only on UNIX systems."
          ^
    Makefile:48: recipe for target '.o/sostream.o' failed
    make: *** [.o/sostream.o] Error 1
    
  • vector resize() non-standard

    vector resize() non-standard

    For the vector template:

    c++11: void resize (size_type n, const value_type& val); c++98: void resize (size_type n, value_type val = value_type());

    ustl has: void resize (size_type n, bool bExact)

  • ustl streams performance

    ustl streams performance

    Hello ! Now that ustl have a minimal streams working I did a comparison with the c++ std on ubuntu 14.04, it reads a csv file of 915254KB and write it to another file line by line, ustl performance is around 8 times slower (800%) than std, memory usage ustl 900KB and std 1.5MB:

    std -> time ./clean-nl-inquotes 
    ted-contracts-2012.csv
    Hello world! Alvarez
    
    real    0m9.787s
    user    0m1.829s
    sys 0m2.443s
    
    ustl -> time ./clean-nl-inquotes 
    ted-contracts-2012.csv
    Hello world! Alvarez
    
    real    1m7.993s
    user    0m57.783s
    sys 0m5.515s
    
    #define USE_STD2
    #ifdef USE_STD
        #include <string>
        #include <iostream>
        #include <fstream>
        #include <sstream>
        #include <algorithm>
        namespace ustd = std;
    #else
        #include <ustl.h>
        namespace ustd = ustl;
    #endif
    
    #include <dirent.h>
    #include <errno.h>
    
    bool startsWith(const ustd::string& s, const ustd::string& preffix)
    {
        return s.size() >= preffix.size() && s.find(preffix) == 0;
    }
    
    bool endsWith(const ustd::string& s, const ustd::string& suffix)
    {
        return s.size() >= suffix.size() && s.rfind(suffix) == (s.size()-suffix.size());
    }
    
    class OsDir
    {
        DIR *m_dirp;
    public:
        OsDir(){m_dirp = NULL;};
        ~OsDir(){close();}
        bool open(const char *root)
        {
            m_dirp = opendir(root);
            return m_dirp != NULL;
        }
        void close()
        {
            if(m_dirp)
            {
                closedir(m_dirp);
                m_dirp = NULL;
            }
        }
        struct dirent *readdir()
        {
            return m_dirp ? ::readdir(m_dirp) : NULL;
        };
    };
    
    
    int main()
    {
        struct dirent *pde;
        OsDir dir;
        dir.open(".");
    
        while ((pde = dir.readdir())) {
                ustd::string fname = pde->d_name;
                if(endsWith(fname, ".csv"))
                {
                    ustd::cout << fname << ustd::endl;
                    //ustd::ifstream fd_in(fname, ustd::ios::in);
                    ustd::ifstream fd_in;
                    //fd_in.set_delimiters("");
                    ustd::fstream fd_out;
                    fd_in.open(fname, ustd::ios::in);
                    fd_out.open(fname + "2", ustd::ios::out);
    
                    size_t quote_count = 0;
                    ustd::string line;
                    while( ustd::getline(fd_in, line) )
                    {
                        fd_out.write(line.c_str(), line.size());
                        quote_count += ustd::count(line.begin(), line.end(), '"');
                        //accumulate quote count to check when we have a valid line
                        if( (quote_count % 2) == 0 )
                        {
                            fd_out.write("\n", 1);
                            quote_count = 0;
                        }
                    }
                    break;
                }
        }
    
        ustd::string str;
        str += " Alvarez";
    
        ustd::cout << "Hello world!" << str << ustd::endl;
        return 0;
    }
    
Library that simplify to find header for class from STL library.

Library that simplify to find header for class from STL library. Instead of searching header for some class you can just include header with the class name.

Jun 7, 2022
A standard conforming C++20 implementation of std::optional.

A standard conforming C++20 implementation of std::optional.

Feb 11, 2022
Windows Implementation Library

Windows Implementation Libraries (WIL) The Windows Implementation Libraries (WIL) is a header-only C++ library created to make life easier for develop

Jun 15, 2022
42 Cursus - Libft: My implementation of some useful C functions and some additional ones to use it in future projects of 42.

42 Cursus - libft Info My implementation of some useful C functions and some additional ones to use it in future projects of 42. Status: still updatin

Apr 4, 2022
MSVC's implementation of the C++ Standard Library.

Microsoft's C++ Standard Library This is the official repository for Microsoft's implementation of the C++ Standard Library (also known as the STL), w

Jun 17, 2022
Cross-platform STL-styled and STL-compatible library with implementing containers, ranges, iterators, type traits and other tools; actors system; type-safe config interface.

Yato A small repository where I'm gatherting useful snippets and abstractions for C++ development. Yato includes 3 main modules: multidimensional cont

Mar 7, 2022
Browser and NodeJS Web Assembly audio decoder libraries that are highly optimized for size and performance.

WASM Audio Decoders WASM Audio Decoders is a collection of Web Assembly audio decoder libraries that are highly optimized for browser use. Each module

May 30, 2022
Protocol Buffers with small code size

Nanopb - Protocol Buffers for Embedded Systems Nanopb is a small code-size Protocol Buffers implementation in ansi C. It is especially suitable for us

Jun 22, 2022
A library of type safe sets over fixed size collections of types or values, including methods for accessing, modifying, visiting and iterating over those.

cpp_enum_set A library of type safe sets over fixed size collections of types or values, including methods for accessing, modifying, visiting and iter

Jun 16, 2022
Open hardware to measure EC and pH, drive pumps, and otherwise manage a mid-size hydroponic grow over Wi-Fi.
Open hardware to measure EC and pH, drive pumps, and otherwise manage a mid-size hydroponic grow over Wi-Fi.

Hydromisc This is a single PCBA with all the necessary I/O to automate a typical small to mid-size hydroponic grow, controllable over Wi-Fi

May 25, 2022
A variation CredBandit that uses compression to reduce the size of the data that must be trasnmitted.

compressedCredBandit compressedCredBandit is a modified version of anthemtotheego's proof of concept Beacon Object File (BOF). This version does all t

Apr 9, 2022
Complete introduction to size balanced trees (O(1) amortized complexity)

Size Balanced Tree A size balanced tree (SBT) is a self-balancing binary search tree (SBBST) rebalanced by examining the sizes of each node's subtrees

Jun 2, 2022
OSA a is minisatellite/ space probe the size of a can designed to participate in the ESA CanSat 2021 competition 🛰️ 📡 .
OSA a is minisatellite/ space probe the size of a can designed to participate in the ESA CanSat 2021 competition 🛰️ 📡 .

Project OSA OSA a is minisatellite/ space probe the size of a can designed to participate in the ESA CanSat 2021 competition ??️ ?? . Our project is c

Feb 28, 2022
ipcbuf - test/report the size of an IPC kernel buffer

ipcbuf - test/report the size of an IPC kernel buffer Different forms of IPC utilize different in-kernel buffers, depending on a variety of possibly s

Nov 24, 2021
Shared to msvcrt.dll or ucrtbase.dll and optimize the C/C++ application file size.
Shared to msvcrt.dll or ucrtbase.dll and optimize the C/C++ application file size.

VC-LTL - An elegant way to compile lighter binaries. 简体中文 I would like to turn into a stone bridge, go through 500 years of wind, 500 years of Sun, ra

Jun 23, 2022
My new zigbee project. Wireless temperature and humidity mini sensor with electronic ink display 2.13 inches, low power consumption, compact size, enclosure with magnets.
My new zigbee project. Wireless temperature and humidity mini sensor with electronic ink display 2.13 inches, low power consumption, compact size, enclosure with magnets.

My new zigbee project. Wireless temperature and humidity mini sensor with electronic ink display 2.13 inches, low power consumption, compact size, enclosure with magnets. The device use SHTC3 sensors, chip CC2530, battery CR2477.

Feb 22, 2022
CodeCompactor is an open source program designed for reducing the size of your code!

CodeCompacter An exciting, new and open source program for reducing the length of your code! Usage: ./CodeCompacter {ARGUMENTS} Arguments: -L {languag

Nov 28, 2021
esp32s2 implement a usb port display with 320*240 size with ~13pfs
esp32s2 implement a  usb port display with 320*240 size with ~13pfs

esp32s2_usb_display overview it's a USB mini display for Linux platform, such as raspberry Pi, Centos X86 server. it refer many opensource projects: r

May 30, 2022