A size-optimized STL implementation.

Overview

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 !

    opened by mingodad 18
  • 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 !

    enhancement 
    opened by mingodad 16
  • [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
    
    bug 
    opened by dfateyev 10
  • 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!

    bug 
    opened by hoangmle 8
  • 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

    rejected 
    opened by M00N-MAN 8
  • 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 !

    enhancement 
    opened by mingodad 8
  • 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*}’|
    
    
    bug 
    opened by mingodad 6
  • 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

    notabug 
    opened by Gerii 6
  • 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
    
    opened by mwarning 6
  • 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)

    bug 
    opened by LinuxEngr 5
  • 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;
    }
    
    rejected 
    opened by mingodad 5
Releases(v3.0)
  • v3.0(Feb 18, 2022)

    • Raise minimum required gcc version to 5.
    • Always use c++14.
    • Only support building a static library.
    • Only support standalone build, without libstdc++.
    • Use consistent configure flag names.
    • Use more constexpr.
    • Fix build problems with up to gcc 12.
    • Mention forcefully that this library is now obsolete.
    Source code(tar.gz)
    Source code(zip)
  • v2.8(Dec 15, 2018)

    • Mark the project obsolete.
    • Add ustl::begin, cbegin, end, cend, data, and size.
    • Add istringstream(const char*) constructor.
    • Add to_string(unsigned).
    • Add operator!=(pointer) overload to smart pointers.
    • Correct advance to modify the pointer argument.
    • Preallocate string returned by to_string.
    • istringstream::read will now keep incomplete reads.
    • Require clang 4 to for c++11 on OSX.
    • Remove exchange from pre-14 code.
    Source code(tar.gz)
    Source code(zip)
  • v2.7(Jul 31, 2018)

    • Make vector resize take a second argument for fill value.
    • vector dtor should not call dtors when linked.
    • exchange algo should be c++14 only.
    • Add required explicit scoping for swap in pair and smart pointers.
    • Make swap implementation shared with c++98.
    • Fix some warnings from -Weffc++.
    • Fix new warnings and errors from gcc 8.1.
    • Add workaround for gcc 8.1 bug 85695.
    • ifdef out _long4grain alignof spec on 32bit platforms.
    • Replace C-style casts with C++-style casts.
    • Remove obsolete --without-mmx configure flag.
    Source code(tar.gz)
    Source code(zip)
  • v2.6(Dec 13, 2017)

    • Fix erase cow sometimes truncating strings.
    • Fix hang in istringstream read_number at end of stream.
    • Fix test failures new with gcc 7.2.
    • Fix configure directory detection with new gcc.
    • Remove operator<< and operator>> templates for ustl types.
    • Add pkg-config file
    • Do not use memcpy in fallback implementation of copy_n_fast.
    • Remove -march=native from default compiler flags.
    • Add configure --with-native flag.
    Source code(tar.gz)
    Source code(zip)
  • v2.5(Nov 25, 2016)

    • Implement chrono.
    • Implement ratio.
    • Implement gcd and lcm.
    • Implement exchange, clamp, minmax, and minmax_element algorithms.
    • Implement front_insert_iterator and move_iterator.
    • Add uninitialized_default_construct and uninitialized_value_construct.
    • Implement uninitialized_move, destroy_at, and destroy_n.
    • Add void_t, is_swappable, and common_type type traits.
    • Implement c++11 float fields in numeric_limits.
    • Implement ostringstream fill and setfill manip.
    • Fix some clang compatibility warnings.
    • Give descriptive names to tests.
    Source code(tar.gz)
    Source code(zip)
  • v2.4(May 10, 2016)

    • Implement scope_exit and unique_resource
    • Implement c++11 members of priority_queue, stack, and queue
    • Do not remove lvalue make_pair for c++11
    • Fix previously broken heap implementation
    • Fix utf8out_iterator postfix ++ to not create a new iterator
    • A more thorough utf8 encoder test
    • Add constexpr to definition of string::npos
    • Support dash shell for configure
    • Fix compiling --with-libstdc++
    • Fix early inclusion of system headers when using force-inline
    Source code(tar.gz)
    Source code(zip)
  • v2.3(Jan 16, 2016)

    • Implement unique_ptr and shared_ptr
    • Implement atomic
    • Implement is_constructible, is_destructible, is_assignable, and variations
    • Enable c++14 compilation for clang 3.6+ and gcc 5+
    • Numerous improvements to streams API
    • Add all stream formatting manipulators: setw, setprecision, etc.
    • Increase default stream buffer size to improve ifstream/ofstream performance.
    • Implement string-number conversions.
    • Rename libc_exception to system_error; in c++14 that is now a standard
    • Fixes to compile on Debian and OS X
    Source code(tar.gz)
    Source code(zip)
  • v2.2(Jan 18, 2015)

    • Implement C++11 type traits
    • Some fixes for incorrect behavior of array
    • Coding style changes based on "Effective C++" recommendations
    • Fix string vformat sometimes leaving string empty
    • Fix crash when using string.erase(i,string::npos)
    Source code(tar.gz)
    Source code(zip)
  • v2.1(Jan 22, 2014)

  • v2.0(Nov 8, 2013)

    • Some C++11 features implemented. All containers now have move operations, emplace, and initializer lists. noexcept and constexpr added where appropriate.
    • Conform string API to standard All standard member functions are now present API change: insert(s,c,n) to insert(s,n,c)
    • Compilation with clang is now supported. clang 3.2 required.
    • Change margin allocation strategy to pow2 growth from +64
    • reserve will now use margin allocation by default, resize is still exact
    • Detect sys/mman.h and make it optional
    • Do not close stdin,stdout,stderr on exit
    • Do not use %m to format errors
    • Enable copy-on-write in memblock erase
    • Replace header guards with pragma once
    • Stop stripping zeroes when assigning specified-length strings
    Source code(tar.gz)
    Source code(zip)
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.

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

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

null 31 Aug 24, 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

Microsoft 2k Sep 30, 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

izenynn 7 Jul 21, 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

Microsoft 8.2k Oct 3, 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

Alexey 9 Jul 22, 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

Ethan Halsall 61 Sep 24, 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

null 3.2k Oct 1, 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

Carl Dehlin 22 Jun 16, 2022
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

null 476 Sep 29, 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

Conor Richard 18 Sep 22, 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

Jishan Shaikh 18 Jun 2, 2022
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

OSATeam 10 Jul 10, 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

Jan Schaumann 6 Sep 7, 2022
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

Chuyu Team 231 Sep 29, 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. The device use SHTC3 sensors, chip CC2530, battery CR2477.

Andrew Lamchenko 17 Sep 11, 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

Henry Dewsnap 1 Nov 28, 2021
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

null 9 Aug 9, 2022