standard-library Questions

7

Solved

In the book "The C Programming Language" it says: "Many of the functions in the library set status indicators when error or end of file occur. These indicators may be set and tested explicitly....
Reinold asked 12/7, 2009 at 18:23

2

Solved

For applicable data types a good radix sort can beat the pants off comparison sorts by a wide margin but std::sort is usually implemented as introsort. Is there a reason to not use radix sort to im...
Sanmicheli asked 6/10, 2015 at 9:47

6

Solved

Say an OS/kernel is written with C++ in mind and does not "do" any pure C style stuff, but instead exposes the C standard library built upon a full-fledged C++ standard library. Is this possible? I...
Tenorrhaphy asked 24/2, 2011 at 19:53

3

Solved

In Python, the fractions.Fraction and decimal.Decimal standard library classes exist to help keep arithmetic with rational numbers precise. For the unfamiliar, an example of where it helps: >&g...
Wesson asked 7/11, 2016 at 15:23

4

Solved

A textbook I have notes that you can provide your own implementation for standard library functions like swap(x,y) via template specialization or function overloading. This would be useful for any ...
Sustenance asked 18/8, 2011 at 13:17

6

Solved

The Java Collections.max method takes only a collection of a sortable (Comparable) object. However since the collection is not necessarily sorted, I don't see any reason not to implement the same m...
Morsel asked 14/1, 2009 at 17:38

5

I was told when writing Microsoft specific C++ code that writing Sleep(1) is much better than Sleep(0) for spinlocking, due to the fact that Sleep(0) will use more of the CPU time, moreover, it onl...
Kauai asked 26/6, 2013 at 16:44

3

Solved

Python's standard library is vast, and my intuition tells that there must be a way in it to accomplish this, but I just can't figure it out. This is purely for curiosity and learning purposes: I ha...

51

Solved

I might have an array that looks like the following: [1, 4, 2, 2, 6, 24, 15, 2, 60, 15, 6] Or, really, any sequence of like-typed portions of data. What I want to do is ensure that there is only on...
Dorfman asked 9/9, 2014 at 7:21

2

Solved

I'm implementing an iterator that iterates over the results of a generator function rather than over a data structure in memory such as a vector or map. Reading through the final working draft for...
Smug asked 8/10, 2017 at 1:52

32

Solved

Looking for a better way to get a machines current external IP #... Below works, but would rather not rely on an outside site to gather the information ... I am restricted to using standard Python ...
Tsushima asked 22/2, 2010 at 14:36

2

Solved

The Agda standard library contains some modules Relation.Binary.*.(Non)StrictLex (currently only for Product and List). We can use these modules to easily construct an instance of, for example, IsS...
Conchaconchie asked 23/6, 2014 at 8:57

1

I am trying to compile a program with x11 and use musl for the c library. I still have glibc on my system. Musl is located at /usr/local/musl/include The glib headers are still in /usr/include Whe...
Yoho asked 9/2, 2017 at 4:12

4

Solved

I am trying to parse a simple CSV file, with data in a format such as: 20.5,20.5,20.5,0.794145,4.05286,0.792519,1 20.5,30.5,20.5,0.753669,3.91888,0.749897,1 20.5,40.5,20.5,0.701055,3.80348,0.69532...
Macleod asked 30/5, 2012 at 10:20

1

In Python, I want to get the current Unix timestamp and then store the value for the long term and be handled by non-Python systems. (I am not merely trying to compute the difference between two ti...
Paradisiacal asked 26/2, 2021 at 22:51

4

Solved

In Kotlin, when working with the JVM, it seems there is multiple choices for standard library, namely kotlin-stdlib, kotlin-stdlib-jdk7 and kotlin-stdlib-jdk8. I cannot, however, find anything tel...
Snuffle asked 15/8, 2018 at 12:20

14

Solved

Go's standard library does not have a function solely intended to check if a file exists or not (like Python's os.path.exists). What is the idiomatic way to do it?
Disappoint asked 20/9, 2012 at 18:42

2

Regular Python packages register entrypoints in their setup.py or specify them in a pyporject.toml file. The latter is the case, if they don't use distutils/setuptools for packaging. As an example,...
Snook asked 9/2, 2020 at 10:33

3

Solved

Is there a way to perform a partial sort on an array of data so that the last n elements are sorted? By good I mean using the standard library, not implementing my own sort function (this is what I...
Padua asked 15/1, 2013 at 23:6

2

Solved

I wanted to see how a math.py function was implemented, but when I opened the file in PyCharm I found that all the functions are empty and there is a simple pass. For example: def ceil(x): # real ...
Stutter asked 14/7, 2016 at 21:3

12

I have two postcodes char* that I want to compare, ignoring case. Is there a function to do this? Or do I have to loop through each use the tolower function and then do the comparison? Any idea how...

1

Solved

I've noticed a deprecation note on the Rust std page next to u8, i8, u16 and so on: What is going on, and what will the replacement be?
Mossberg asked 1/2, 2022 at 19:15

3

Solved

I know the std::priority_queue class implements a minheap. Is there a way to use this as a Max heap? Or is there an alternative Maxheap structure? I know I can use the std::make_heap() function on ...
Withershins asked 30/7, 2019 at 12:6

5

Solved

There are some threads on Stack Overflow dealing with implementing priority queues in .Net and C#. My issue is of a more basic nature: Why isn't there a priority queue out of the box in the .Net f...

6

Solved

When C has the / operator to divide two numbers, what is the purpose of having the div() library function? Is there any scenario where / can't be used but div() can?
Balladmonger asked 30/7, 2012 at 16:43

© 2022 - 2024 — McMap. All rights reserved.