Answer by xaxxon for What is the use of const in the given function when the...
methods not marked const cannot be called on a const object (or ref or pointer to a const object). StatDemo sd;StatDemo const & sdr = sd;sdr.get(x); // error because getx isn't marked constHowever,...
View ArticleAnswer by xaxxon for Thread safe queue gives segmentation fault
std::unique_ptr<ThreadSafeQueue<std::stringstream>> logMessages;You never allocated memory for this variable. It's not pointing to a ThreadSafeQueue<> objectMaybeauto logMessages =...
View ArticleTrying to validate any ARM Template but getting: 'Error converting value to...
I'm trying to validate an arm template - ANY arm template - but I always get the same error:The request content was invalid and could not be deserialized: 'Error converting value "{...}" to type...
View ArticleAnswer by xaxxon for Trying to validate any ARM Template but getting: 'Error...
According to the docs:template object The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a...
View ArticleAnswer by xaxxon for `enable_if()` to disable static member function...
Enable_if only works in deduced contexts. In your example, the deduction is done at class type time. By the time you get to the functions, T is already known, so there isn't anything to deduce.You can...
View ArticleAnswer by xaxxon for Copy a git repo without history
Isn't this exactly what squashing a rebase does? Just squash everything except the last commit and then (force) push it.
View ArticleAnswer by xaxxon for How network event FD_WRITE is generated when using Event...
FD_WRITE means you can write to the socket right now. If the send buffers fill up (you're sending data faster than it can be sent on the network), eventually you won't be able to write anymore until...
View ArticleAnswer by xaxxon for Explicit specialization - template-id does not match any...
Your template returns the type T and takes a type T* but your specialization returns the same type as it takes, so it doesn't match. If you specialize for T=char*, then it needs to take a T* (char**)...
View ArticleCLion 2017.3 unable to autocomplete through unique_ptr using clang 5 (works...
edit: scroll to bold section below for current status.CLion seems to be unable to autocomplete members of a type pointed to by a unique_ptr in clang 5. I either get "no suggestions" or I get...
View ArticleAnswer by xaxxon for C++ headers not found on OSX Sierra
/usr/local/bin/clang is not a standard location for the system clang installation.It looks like you have a corrupt installation there maybe. Try the one in /usr/bin and see if you have better luck.Or...
View ArticleAnswer by xaxxon for Using move semantics: rvalue reference as a method...
You're almost always best just taking inputs you're going to keep by value (except for odd types which have very high costs of moves). It maintains the same level of performance (in common scenarios)...
View ArticleCan you include scripts to be run as azure functions in a managed app .zip file?
I want to include some functionality via an azure function along with my managed app and was hoping I could include it in the .zip file you specify which has your mainTemplate.json and...
View ArticleAnswer by xaxxon for What is the different between +[](){}; and (+[](){});...
{} is, it returns an r-value object std::function<void()>No, it creates a lambda/closure which is its own kind of thing. There are cases when that is turned into a std::function, but what you're...
View ArticleAnswer by xaxxon for Variadic template tensor class
You just need to expand the parameter pack.#include <array>template <typename T, int m, int ...n>class Tensor {public: std::array<Tensor<T, n...>, m> a;};
View ArticleIn GTest, how to check for number very close to 0? EXPECT_FLOAT_EQ not working
I have some code that computes (a)sin/(a)cos values which are expected to be very close to 0, but when I say EXPECT_FLOAT_EQ(my_computed_var, 0);I get errors like:/path/to/my/test.cpp:148: Failure...
View ArticleAnswer by xaxxon for std::is_convertible template implementation
This tests to see if the type T is valid to return from a function via SFINAE and returns true_type or false_type depending on the result.For example, functions have types yet cannot be returned from...
View ArticleHow to deploy a managed application with an identity having permissions...
When deploying a marketplace managed app offer into a customer subscription, you can create an identity in the managed resource group associated with the managed application. However, in order for that...
View ArticleHow to generate fake data that looks real in a graph [closed]
I want to generate fake data for use in testing a graphing library (highcharts in this case, but it doesn't really matter). I'd like to generate random data on each click that looks like it might...
View Article’ has non-pointer type" when calling my function">Answer by xaxxon for I am getting a "base operand of ‘->’ has non-pointer...
animal.at(0) is of type Animal, not Animal*. So you just use a . not an ->If you made animal a vector<Animal*> then you'd use ->
View ArticleAnswer by xaxxon for Sonar unable to read my CPPUnit report
As we eventually found, the XML had to be transformed via some XSL to a different format which is provided on the site for the plugin...
View ArticleHow do you deploy a python azure function with an arm template?
The following deploys a azure function that run the specified C#. How do I do the same for a function that should run python?I tried just changing the name to __init__.py as is generated when you use...
View ArticleAnswer by xaxxon for Fast C++ String Output
How much data? Store it in RAM until you're done, then print it. Also, file output may be faster. Depending on the terminal, your program may be blocking on writes. You may want to select for...
View ArticleIn CLion, header only library: file "does not belong to any project target,...
I have a header-only library project set up with the cmake command:add_library(my_library INTERFACE)and I also added target_sources(my_library INTERFACE ${MY_LIRBARY_HEADER_FILES})but when I open a...
View ArticleCLion not debugging one of my targets - immediate `Process finished with exit...
I'm on a Mac using Clang 6. I have a project with a few targets and they all worked as expected until recently when suddenly I could not debug my unit tests. I give the command to debug and it...
View ArticleAnswer by xaxxon for Is it Undefined Behavior to have a non-POD struct...
No.There's really not much more to add. There isn't something to point to to say that it's not legal.Also, if it were a problem it would be trivial for your compiler to warn you you're doing something...
View ArticleAnswer by xaxxon for How to debug with gdb when you are not familiar with...
You need to get used to black box functions that crash when not used correctly. You need to read the docs of the functions you use: en.cppreference.com/w/cpp/algorithm/sort and...
View ArticleAnswer by xaxxon for When using std::thread class, why exactly can I pass...
Your first example doesn't fail because of the compiler knowing the lifetime of variables. It fails for this very specific...
View ArticleAnswer by xaxxon for Does C++ type conversion do rounding automatically?
See the warnings here: https://godbolt.org/z/vzE3976hP -- it says what @n.m.couldbeanAI says -- it's converting to double because you wrote 1000.0 not just 1000The following link/code does what you...
View ArticleAnswer by xaxxon for Minimum (positive) floating point number (closest to zero)
I'm trying to find the minimum value (closest to zero) that I canstore in a single precission floating point number0 is the closest value to 0 that you can store in any precision float. In fact, you...
View ArticleAnswer by xaxxon for Is it false positive here: warning C4172: returning...
You're not returning the thing you have by reference, you're returning the results of a function call.That the function happens to be on a method you have a reference to is irrelevant.const...
View ArticleComment by xaxxon on Failed TCP Socket Communication
"Make sure to bind() your server socket to the local LAN IP that is directly connected to the router/Internet where the client will be coming from" - not sure what you meant by that but it's at best...
View ArticleComment by xaxxon on Why SIGSEGV behaves differently from other Exception...
The only "don't die on seg fault" handler I've ever seen has setjmp/longjump involved. Basically if you exit the handler via any type of normal control flow, your program will end. There's nowhere even...
View ArticleComment by xaxxon on Are C/C++ fundamental types atomic?
C and C++ are not the same language nor is C++ a superset of C. Therefor it is inappropriate to ask a question of both of them.
View ArticleComment by xaxxon on Function for doing a math problem with code
In the future when you make a post, put the actual problem in the title, don't use the title to tell a story.
View ArticleComment by xaxxon on Can I guarantee that recv() will not block after...
yes, all network calls should be made nonblocking and with checking for every error type possible. This is CRITICALLY important. All sockets should be made nonblocking for all nontrivial applications.
View ArticleComment by xaxxon on Why creating the same class object allowed inside a...
The sizes of your object would literally be infinite if it contains itself. A function containing an object doesn't matter. It doesn't affect the object. The object cntains itself which contains itself...
View Article
More Pages to Explore .....