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
0
votes
5 answers

Calling a method in a static library

I'm trying to write a C standard library from scratch on OSX with gcc. When I try to include a header file from my library in my test program, I get the error that it isn't defined. I try to use the -nostdlib flag but I still can't include my…
0
votes
1 answer

import function from standard library after importing similarly named function from other library

This is a curiosity. Say I am using IPython interactively, which by default imports from numpy import sum and after that I decide to use sum from the standard library. Say, to do something like texts =…
dmvianna
  • 15,088
  • 18
  • 77
  • 106
0
votes
4 answers

Simplest way to mix sequences of types with iostreams?

I have a function void write(const T&) which is implemented in terms of writing the T object to an ostream, and a matching function T read() that reads a T from an istream. I am basically using iostreams as a plain text…
Kylotan
  • 18,290
  • 7
  • 46
  • 74
0
votes
3 answers

How to get the lowest representable floating point value in C++

I have a program where I need to set a variable to the lowest representable (non infinite) double-precision floating point number in C++. How am I able to set a variable to the lowest double-precision floating point value? I tried using…
Zachary Miller
  • 179
  • 1
  • 9
0
votes
2 answers

Containers in C++11 STL

struct Solution { double power_peak; valarray assignment; }; list list; list.pop_back(); list list2; list2.pop_back(); function(list2); Hello i still don't understand how these containers work with respect to their…
user3613886
  • 231
  • 3
  • 7
0
votes
2 answers

std::map not removing duplicates with custom object

all. So, I have created a Comparable base class (a la Java) which does the job of overloading comparison operators in C++. Here it is: template class Comparable { public: bool operator== (const T& rhs) const { return this->compare(rhs)…
Karl Giesing
  • 1,654
  • 3
  • 16
  • 24
0
votes
1 answer

ostringstream to vector for Multithreaded Queue

So I have an application which is a server that opens several threads which will be used for database queries. In my receive function, I tested the output for my query which I built and it looks fine when I cout the ostringstream, so I add it to a…
Uwop
  • 89
  • 1
  • 2
  • 7
0
votes
1 answer

Core header files in c++

When we want to using a function from standart c++ library we're inculding a coressponding header file. But header file is just contains the function declaration. From what implementation of this function is appear? Consider the following simple…
user2889159
0
votes
2 answers

Why do standard libraries have better portability then system calls

I'm studying for my final in my Systems programming class, and my notes mention to use standard libraries where possible because they have better portability than system calls, but not WHY. Is this because that system calls vary between operating…
JustinM
  • 1
  • 1
0
votes
4 answers

How does conversion specifier work?

Can I check my understanding of scanf? int a; scanf("%d",&a); If I input 13, does conversion specifier convert 13 to binary and stored it in a? If input is 13.3, then does it convert decimal fraction 13.3 to binary and store it in a?
srira
  • 61
  • 1
  • 7
0
votes
3 answers

Mutex/Lock with scope/codeblock

I remember seeing it in some conference, but can't find any information on this. I want something like: lock(_somelock) { if (_someBool) return; DoStuff(); } // Implicit unlock Instead of: lock(_somelock); if (_someBool) { …
TheDespite
  • 333
  • 1
  • 2
  • 11
0
votes
2 answers

What is the address of back() in an empty container?

I mistakenly took the address of the reference returned by the back() operator in an empty container and was surprised to see that the address wasn't zero. If a container e.g. std::deque is empty, what does back() return?
BeeBand
  • 10,953
  • 19
  • 61
  • 83
0
votes
1 answer

C++ iterator of heterogeneous types iterators

I have a structure which contains vectors of different types. I would like to create a single iterator that would iterate every element of every vector, and according to specific rules, provide a specific value using the * operator. I already…
vkubicki
  • 1,104
  • 1
  • 11
  • 26
0
votes
2 answers

Python - exec(expression, globals=None, locals=None)

I understand the basic use of eval as shown as an example in the Python standard library: x = 1 print(eval('x+1')) 2 Could someone please provide a more concise explanation with examples for the utilisation of both the globals and locals…
Phoenix
  • 4,386
  • 10
  • 40
  • 55
0
votes
4 answers

Python - classmethod( )

Reading Python Standard Library. Trying to understanding classmethod. class C: @classmethod def f(x,y): print('words') When I type: print(classmethod(C)) It returns: How would see what the…
Phoenix
  • 4,386
  • 10
  • 40
  • 55