guideline-support-library Questions

1

I'm parsing a binary network data and i would like to make the process as allocation-less as possible. But now i realized there are 2 very similar concepts that are probably both good enough for my...
Dooley asked 15/4, 2021 at 9:17

2

I saw a code that used narrow_cast like this int num = narrow_cast<int>(26.72); cout << num; The problem is my compiler said: 'narrow_cast' was not decleared in this scope. Am I...
Oregano asked 29/10, 2019 at 21:54

1

Solved

From what I can gather, gsl::string_span and std::string_view seem to have essentially the same rationale for use. Is that indeed the case? If so, are they effectively identical? If not - how do th...
Whiskey asked 29/10, 2018 at 18:9

1

Solved

I know the use of assert in C++. Wanted to know is there any difference between and any benefit(I think assert is costlier according as mentioned in https://www.learncpp.com/cpp-tutorial/7-12a-asse...
Heliotaxis asked 29/5, 2019 at 12:35

1

Solved

In the Microsoft implementation of guidelines support library I see the following piece of code: template<class T> class not_null { ... template <typename U, typename = std::enable_if_t...
Nightwalker asked 3/7, 2018 at 15:12

1

Solved

In the Guidelines Support Library there is a class called final_action (essentially the well known ScopeGuard). There are 2 free-standing convenience functions to generate this templated class: //...

2

Stroustrup gave a talk last year about his GSL (Guideline Support Library). There is an implementation by Micosoft at https://github.com/Microsoft/GSL . I was under the impression that the GSL was ...
Leone asked 2/5, 2016 at 11:7

2

Solved

C++ Core Guidelines has been presented recently (congrats!) and I am concerned about gsl::not_null type. As stated in I.12: Declare a pointer that must not be null as not_null: To help avoid der...

2

I have a class with a std::vector<int> member and a member function returning a const reference to that vector. class demo { public: //... const std::vector<int> & test() const ...
Stoma asked 23/11, 2016 at 13:3

0

I (mostly) like the new C++ Core Guidelines initiative, and what the Guidelines Support Libary offers. Specifically, I want to use spans more. However, I'm coming up against the issue of __restrict...
Swelter asked 30/5, 2016 at 8:50

1

Solved

I am trying to understand how to use Ensures() in code. As given in the example, if I tried using Ensures() as follows... int main(void) { int result = 0; // Some calculation Ensures(result == ...

1

Solved

I tried a little example to get used to the GSL and range-v3 libraries and I wondered how they could work together. I have this toy example #include <iostream> #include <range/v3/all.hpp&...
Strunk asked 26/3, 2016 at 10:30

3

Solved

In several recent conference presentation I've heard Bjarne Stroustrup and others mention new coding guidelines for C++ and some types supporting them. Specifically, I remember the example of spa...
1

© 2022 - 2024 — McMap. All rights reserved.