Questions tagged [fundamentals-ts]

The C++ Technical Specification "Library Fundamentals"

C++ is standardized in an ISO International Standard (IS). In addition to the IS, ISO also publishes a series of Techinical Specifications (TS) on specific domains.

The Library Fundamentals TS contains additions and evolution of general-purpose, core library components (such as string_view, optional, any).

12 questions
241
votes
2 answers

What is string_view?

string_view was a proposed feature within the C++ Library Fundamentals TS(N3921) added to C++17 As far as i understand it is a type that represent some kind of string "concept" that is a view of any type of container that could store something…
Drax
  • 12,682
  • 7
  • 45
  • 85
16
votes
1 answer

How could std::experimental::source_location be implemented?

C++ Extensions for Library Fundamentals, Version 2 (N4564) introduces the type std::experimental::source_location. § 14.1.2 [reflection.src_loc.creation] says: static constexpr source_location current() noexcept; Returns: When invoked by a…
5gon12eder
  • 24,280
  • 5
  • 45
  • 92
15
votes
1 answer

string_view behaviour when passing temporary std::string

I just ran into some misunderstanding: at least in libc++ implementation std::experimental::string_view has the following concise implementation: template class basic_string_view { public: typedef _CharT…
Bikineev
  • 1,685
  • 15
  • 20
2
votes
1 answer

Python OOP challenge, problem with object and method

class Song: def __init__(self, title, artist): self.title = title self.artist = artist def how_many(self, listener): print(listener) obj_1 = Song("Mount Moose", "The Snazzy Moose") obj_1.how_many(['John',…
NewCoder
  • 51
  • 4
2
votes
1 answer

Detect operator++ signature with std::is_detected_exact

I want to detect at compile time if a given type has the pre-increment operator with the library fundamentals TS v2 type_traits' is_detected_exact helper - however, it seems like I either misunderstood this helper or I supplied the wrong parameters,…
Christian G
  • 943
  • 9
  • 16
1
vote
1 answer

Stuck with Matrix addition in python

Please look at my code for matrix addition in python and help me to resolve the issue. Code: def matrix_addition(a, b): # your code here res = [] for i in range(len(a)): for j in range(len(b)): sum = a[i][j] + b[i][j] …
0
votes
0 answers

C++: C-style String Acting Like An Array Of Chars?

Hello to anyone reading this. I am new to C++. I have some conceptual questions about C-strings. I learned that C-string acts like an array from another stack discussion, but I am confused by the following: I know that in C++, for arrays: int…
Pictsit
  • 15
  • 4
0
votes
2 answers

C++ Rock Paper Scissors

I`m trying to make Rock Paper Scissors game in c++.I tested my code on codecademy.com And It worked Properly but when I execute it on codewars.com It gives me this error : main.cpp:29:1: warning: control may reach end of non-void function…
0
votes
2 answers

No operator "*" matches these operands

this is my code glm::vec3 v(4, -6, 7); glm::vec3 twiceV = 2 * v; I have included glm Stable and experimental glm extensions. Why I cannot use int * vec?
Morovo
  • 3
  • 1
  • 3
-1
votes
3 answers

Replace all 0's with 5 || i wrote code but its not working expected| o/p is in reverse order

Problem: Given a number N. The task is to complete the function convertFive() which replace all zeros in the number with 5 my code| plz validate any help me public class Replaceall0swith5 { public static void convertFive(int n) { //add code…
Pankaj
  • 31
  • 5
-1
votes
3 answers

C# form switch and vice versa

Assume that I have a C# Solution with 3 projects Main, Program1, Program2. I want to have a "Main form", when I click on button "Program1" the main form will be hidden, Program1 will be showed, and when I close Program1, the Main form will…
Luke
  • 1,623
  • 3
  • 24
  • 32
-2
votes
1 answer

Exes and Ohs (C++)

This is what I am asked to do:Check to see if a string has the same amount of 'x's and 'o's. The method must return a boolean and be case insensitive. The string can contain any char. Examples input/output: XO("ooxx") => true XO("xooxx") =>…