Ilya
Unsure if it works for classes as well
Sandeep
Unsure if it works for classes as well
Okay thanks..I'll check
Vitalii
Sorry, what is the best way to define a template class in a .h file and implement it in a .cpp file? I saw that ppl include .cpp in main. So, I'm interested how do you all do that
Vitalii
I tried to include .cpp in .h file, but there are errors XD
Ilya
Sorry, what is the best way to define a template class in a .h file and implement it in a .cpp file? I saw that ppl include .cpp in main. So, I'm interested how do you all do that
You can't just put template specialization in cpp file( But, you can put there specializations of this templates. The reason is template is just a set of rules of how to instantiate this template class. Imagine if in compile time you try to replace template arguments with concrete types. If the code where you should place this type in other translation unit, you just cant acces it) So just write the whole template in hpp file 😃
Ilya
About specializations, put extern template class ClassName<template arguments>; inside hpp file and now you can write the definition of concrete class with concrete template arguments inside cpp
Ehsan
No one
🤣🤣🤣🤣🤣🤣
Miquel
Hello! I am programming a project but i have a trouble with a map, in my program i have a function that read a class called 'Sesion' and then i need to insert it into a map<string,Sesion>. I checked just before the map.insert() function which where the values of the pair i was going to insert and everything was ok, but when i use find function to get it back and read data i inserted before there's an element of 'Sesion' which hasn't been inserted within the 'Sesion', it's a map<string, pair<string,string>> an becomes empty when it wasn't. I've got no idea what happens i tried to look for on internet but nothing xdddd
Miquel
Anyone have experienced something like this?
сумбула
when i wanted to add header file into my project in CLion it says CMake cannot find source file. But yesterday it was working good. how can i handle it?
Prakhar
#goodgoogling
Miquel
do you use map::operator[] somewhere?
i basically use .find()->
Miquel
I actually have noticed that the insert function does the work correctly even though the make_pair() does not save all the data. Note:
Miquel
class Sesion{ private: BinTree<string> arbol_problemas; string id; map<string,pair<string,string>> problemas; };
Miquel
The last one "problemas" doesn't get passed
Ilya
struct Entity { static int x, y; void Print() { std::cout << x <<"," << y << std::endl; } }; int Entity::x; int Entity::y; Why should I declare them outside the struct also If I don't I'm unable to Entity e; E.x=2;
Static members of a class are not associated with the objects of the class: they are independent variables with static or thread (since C++11) storage duration or regular functions. The static keyword is only used with the declaration of a static member, inside the class definition, but not with the definition of that static member: https://en.cppreference.com/w/cpp/language/static
Ilya
This is why)
Sandeep
This is why)
I meant why do I have to declare it again
Ilya
You have to define, not to declare
Sandeep
Yeah define
Ilya
static int x, y; declaration
Ilya
int Entity::x; definition
Ali
https://pastebin.com/H9UPfpyh I want to optimize this local maxima function. It is taking around 292 micro seconds for array length 1000 need to reduce it around 230us something. It is for digital signal processing hence want to reduce the time. Any suggestions for the same?
Anonymous
good evening everybody
Anonymous
#rose_as_my_girlfriend
Paul
qbasic
It was one of my first ages and ages ago
Anonymous
Today is my Object oriented programming papar
Anonymous
Plz help me
Ammar
!report
Anonymous
Sorry everyone if you don't like it
N4gu4l
/get cbook
X
hi! while we are comparing strings with strcmp function, how can a string be greater than other?
X
for example, str1 = aaaaaaa & str2 = z
X
however, strcmp(str1, str2) will return <0 ; how its possible?
X
as ascii codes ||| aaaaaaaa = a(97)*9 , but z = 122
X
so, str1 = 873 length & str2 = 122 length... how can str1 be lower than str2? !!!!!! 😡😡😡
Huon
Hi
Huon
I want to learn project in dev c++
Suka
however, strcmp(str1, str2) will return <0 ; how its possible?
because a < z. Compare two strings Compares the C string str1 to the C string str2. This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until a terminating null-character is reached. https://www.cplusplus.com/reference/cstring/strcmp/
Suka
awesome. thank you ^^
you're welcome
Aseem
Guys I need a compiler for windows 32 bit for C Anyone??
Suka
Guys I need a compiler for windows 32 bit for C Anyone??
TinyC compiler http://download.savannah.gnu.org/releases/tinycc/
Devjit
I
Devjit
Devjit
Alishba
Can we hard code multiple values of class in the constructor In c++
Alishba
I mean if I have to store values worth an array
Yusuf
Hi guys, have you tried Rust? What do you think about that language? Will it replace C/C++ in the future? I asked here because I will get answer from people with some experience in C/C++ before using Rust. (is this off topic?)
Anonymous
Guys I need a compiler for windows 32 bit for C Anyone??
tinyc works fine, or you can compile for both 32 amd 64 bit arch in vs debugger
Official hooligan of Pius XII
Hi guys, have you tried Rust? What do you think about that language? Will it replace C/C++ in the future? I asked here because I will get answer from people with some experience in C/C++ before using Rust. (is this off topic?)
C/C++ may be replaced by Rust in a distant future but for now it doesn't calculate. Lots of software still use C — eg. Linux will be using C for a long time. Nobody's gonna try to rewrite it into Rust. Sure, new software is more and more often written in Rust but you still have to get the older soft to work :)
German
A superb developer should certainly know his way through both legacy and modern code
Anonymous
YOU ARE NOT THE REAL ROSE
Anonymous
/notes
Anonymous
Wtf they identical o.o
Mar!o
I've written a lot of Rust and it has some great features. But replacing C/C++ is impossible because there are too many C/C++ programmers and too much legacy code.
Anonymous
HOW??????
Pavel
HOW??????
/get howtopostcode
Nameful
You can use raw pointers if you want to. Just not in safe code
Anonymous
But no one typed it
Mar!o
You can use raw pointers if you want to. Just not in safe code
Yeah but that's now the point of using rust
Pavel
But no one typed it
They may have deleted the message
Anonymous
Oof, how will we ever make linkers in future rust
Mar!o
Cus no pointers?
No if I want to use raw pointer I can use C. I would use Rust for safety.