Category : containers

I need to parse a binary message where the fields are bit packed. Basically I’m looking for a container that takes a sequence of bytes and then allows efficient access to multiple bits as unsigned values. Pseudo code: std::bitvector<char> vec{std::bitvector::lsbfirst, {0xAB, 0xCD, 0xEF}}; auto value = vec.at(0, 5); // get the first 5 bits Couldn’t ..

Read more

void swappedString (string& current) { string newString = "bar"; current.swap(newString); } string func1() { string result = "foo"; swappedString(result); return result; } I wrote a code where I was swapping the contents of the string during a function call. The code is working fine. But I was skeptical whether this can result in UB. I ..

Read more

I have some problem to understand which parameters would be the right once at the insert function of my <map>, maybe you can help me and explaine why? I wanna open a file, and also save the name of the file which is given by the user over the arguments. To do this I thought ..

Read more

I have a basic powershell script which makes changes to SharePoint online (Office365). This task requires Microsoft.Online.SharePoint.PowerShell module to be installed in the system where the script is to be executed. Below is my docker file: FROM mcr.microsoft.com/powershell:latest WORKDIR ./ CMD pwsh -Command Install-Module Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser -Force COPY SampleScript.ps1 ./ CMD pwsh .SampleScript.ps1 when ..

Read more

I’m trying to use a custom unique_ptr inside a std::pair inside collections. Below is what I have so far, but if I uncomment the first commented-out line then I get an error: No matching constructor for initialization of PairedThing1 So I haven’t gotten as far as putting these pairs in a container (the second commented-out ..

Read more