Most active questions

24 votes
5 answers
2k views

With Clang or similar compilers, is it possible to turn only some warnings into errors?

Compiler warnings generally provide useful hints for common programming errors. It is often recommended to turn compiler warnings into errors (e.g. here). In my experience, this is useful to prevent ...
Christian Stadelmann's user avatar
22 votes
6 answers
4k views

Why use a mutex and not a semaphore?

Looking in cppreference, it seems to imply a std::binary_semaphore may be more efficient than a std::mutex. Is there any reason not to use a std::binary_semaphore initialized to 1 instead of a std::...
Baruch's user avatar
  • 21.9k
25 votes
3 answers
1k views

Only copiable type not accepted in msvc std::vector implementation

In the following code: struct copy_only { copy_only() = default; copy_only(const copy_only&) = default; copy_only& operator=(const copy_only&) = default; ...
Fantastic Mr Fox's user avatar
14 votes
5 answers
723 views

How can I negate a logical value in a base R pipeline?

Running TRUE |> `!`() Results in: Error in !NULL : function '!' not supported in RHS call of a pipe (<input>:1:9) When using magrittr, there is a not() alias, but this does not work for ...
ekatko1's user avatar
  • 472
9 votes
7 answers
1k views

Reformat numbers, inserting separators at fixed positions

There are many lines in a file, like the following: 000100667 ===> 000102833 005843000 ===> 005844000 011248375 ===> 011251958 I would like to insert specific separators into the numbers ...
kuninox's user avatar
  • 135
13 votes
5 answers
599 views

How to return the results only when matching is true in R gsub()

I'm working with a character vector in R (test) where I need to extract specific parts of strings that match a pattern while discarding the original strings that don't match. My current solution is ...
JessicaLiu's user avatar
14 votes
3 answers
2k views

How to create a uint64 whose lower and upper bits reference uint32s?

auto lo = 0u; auto hi = 1u; auto combined = (((std::uint64_t)hi) << 32) | lo; But if I do combined++ then lo and hi are not changed, because combined is a copy. How do I make the lower bits of ...
Wirable2323's user avatar
14 votes
3 answers
2k views

Why is it ok to cast to an undeclared struct pointer in C?

Why does this code compile? struct test is not even forward declared. int main(){ *(int*)((struct test*) 0x1234) = 0x0; return 0; }
Dan's user avatar
  • 3,038
26 votes
1 answer
906 views

How to find the Nth weekday of the month using chrono?

There are lots of SO Q/A's solving this problem in other languages, but not so much in C++. How do I find the Nth weekday of the month using <chrono>? For example what is the day of the month ...
Howard Hinnant's user avatar
22 votes
1 answer
1k views

Find next weekday using chrono

Given a year, month and day, how do I find the next weekday on or after that date? For example, If I have 2025-04-28, how can I find the Friday following 2025-04-28, which is 2025-05-02? What about ...
Howard Hinnant's user avatar
5 votes
7 answers
2k views

Dependency 'androidx.browser:browser:1.9.0-alpha02' requires libraries and applications that [closed]

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction Dependency 'androidx.browser:browser:1.9.0-alpha02' requires libraries and applications that ...
rajar's user avatar
  • 237
12 votes
2 answers
470 views

How can I disable concept evaluation result caching?

It appears that all compilers perform caching of concepts' evaluations. So if some concept was evaluated as false once, it will not be reevaluated again for the same argument: template <typename T&...
Fedor's user avatar
  • 22.6k
18 votes
3 answers
1k views

Android DataStore: unresolved Reference edit, stringPreferencesKey

I'm writing an Android app that is using DataStore. I'm failing to compile even a stripped-down version of it - I always get a compilation error for the import statements saying unresolved Reference ...
de11833's user avatar
  • 183
10 votes
6 answers
549 views

Filter data.frame by list

I want to be able to filter a given data.frame by a dynamic list. Lets say I have a list of filters like this filter_list = list(filter_1 = list(vs = c(0), carb = c(1,4)), filter_2 =...
MGP's user avatar
  • 2,673
7 votes
7 answers
231 views

awk to extract a block of text

I am trying to figure out an awk command/script to extract a block of text from a large file. The file subsection I am interested in is this: Board Info: #512 Manufacturer: "Dell Inc." ...
BoomDizzle's user avatar

15 30 50 per page
1
2 3 4 5
1111