Questions tagged [standard-library]

The standard library contains core utilities provided by all implementations of the language.

The standard library contains core utilities provided by all implementations of the language.

The size and scope of the standard library varies between languages, some provide only a few basic components for such things as string handling and I/O, whereas others provide higher-level tools for a wide variety of tasks such as XML processing, networking and database access.

For questions about specific languages' standard libraries use this tag in conjunction with the tag for the language, or use the indicated tags for these languages:

677 questions
17
votes
1 answer

make_unique arrays, original proposal vs. final

Stephan T Lavavej's initial proposal for make_unique was N3588 It included the following functions: make_unique(args...) make_unique_default_init() make_unique(n) make_unique_default_init(n) make_unique_value_init(n,…
David Stone
  • 26,872
  • 14
  • 68
  • 84
16
votes
4 answers

stdio.h not standard in C++?

I know most compilers allow both: #include and #include But someone argued that is not actually C++ standard. Is that true?
vladutcornel
  • 173
  • 1
  • 1
  • 8
16
votes
1 answer

Does Rust have Collection traits?

I'd like to write a library that's a thin wrapper around some of the functionality in BTreeMap. I'd prefer not to tightly couple it to that particular data structure though. Strictly speaking, I only need a subset of its functionality, something…
zslayton
  • 51,416
  • 9
  • 35
  • 50
16
votes
3 answers

Force import module from Python standard library instead of PYTHONPATH default

I have a custom module in one of the directories in my PYTHONPATH with the same name as one of the standard library modules, so that when I import module_name, that module gets loaded. If I want to use the original standard library module, is there…
jrdioko
  • 32,230
  • 28
  • 81
  • 120
16
votes
6 answers

Alternative ways to browse the python api

Is it just me, or the python standard library documentation is extremely difficult to browse through? http://docs.python.org/3.1/library/index.html http://docs.python.org/3.1/modindex.html Java has its brilliant Javadocs, Ruby has its helpful…
ivo
  • 4,101
  • 5
  • 33
  • 42
15
votes
2 answers

Going through the source code for the prelude brings up weirdness

I was looking for the definition of seq and came across this weirdness. Why do all these functions have the same/similar definitions? seq :: a -> b -> b seq = let x = x in x inline :: a -> a inline = let x = x in x lazy :: a -> a lazy = let x…
TheIronKnuckle
  • 7,224
  • 4
  • 33
  • 56
15
votes
3 answers

Does std::multiset guarantee insertion order?

I have a std::multiset which stores elements of class A. I have provided my own implementation of operator< for this class. My question is if I insert two equivalent objects into this multiset is their order guaranteed? For example, first I insert a…
Naveen
  • 74,600
  • 47
  • 176
  • 233
15
votes
1 answer

What is POSIX, any other interface standards which can replace it?

I was confused by the numerous standards and interfaces for C and C++ programming. There's ANSI C, ISO C, GLIBC, POSIX, Win32, MFC, et cetera. What are the differences between these standards, and how are they related to each other? Under what…
harris
  • 1,473
  • 1
  • 17
  • 26
14
votes
5 answers

Get the (multiplicative) product of a tuple or list?

Let's say I have a class Rectangle(object): def __init__(self, length, width, height=0): self.l = length …
yurisich
  • 6,991
  • 7
  • 42
  • 63
14
votes
5 answers

How does memchr() work under the hood?

Background: I'm trying to create a pure D language implementation of functionality that's roughly equivalent to C's memchr but uses arrays and indices instead of pointers. The reason is so that std.string will work with compile time function…
dsimcha
  • 67,514
  • 53
  • 213
  • 334
14
votes
5 answers

C / C++ equivalents to the Python Standard Library

I depend heavily on Python's standard library, both for useful data structures and manipulators (e.g., collections and itertools) and for utilities (e.g., optparse, json, and logging), to skip the boilerplate and just Get Things Done. Looking…
gotgenes
  • 38,661
  • 28
  • 100
  • 128
14
votes
1 answer

Why standard containers use function templates instead of non-template Koenig operators

This question is inspired by Issue with std::reference_wrapper. Let' say, for example, operator< for std::vector. It's defined as a function template as template< class T, class Alloc > bool operator<( const vector& lhs, …
Lingxi
  • 14,579
  • 2
  • 37
  • 93
14
votes
1 answer

Memory allocator with custom pointer type

I tried to create a custom memory allocator which uses a smart pointer. I do not post the code because it's too big and doesn't add much of information. Then I tested it with a std::vector. It works perfectly well on Xcode. But when I tried to build…
MaksymB
  • 1,267
  • 10
  • 33
14
votes
1 answer

Memory leak in Go http standard library?

Have a Go binary implement an http server: package main import ( "net/http" ) func main() { http.ListenAndServe(":8080", nil) } It will start with ~850 kb or so of memory. Send it some requests via your web browser. Observe it quickly…
Mark
  • 872
  • 2
  • 10
  • 19
13
votes
7 answers

How to workaround the inconsistent definition of numeric_limits::min()?

The numeric_limits traits is supposed to be a general way of obtaining various type infomation, to be able to do things like template T min(const std::vector& vect) { T val = std::numeric_limits::min(); for(int i=0 ;…
user96240