« first day (593 days earlier)      last day (2484 days later) » 

15:17
@JerryCoffin Sorry for hte delay. It would see that as good right now, but will probably need to check that as well!
 
2 hours later…
17:39
struct Edge : public std::pair<int, std::int64_t> {
	using std::pair<int, std::int64_t>::pair;

	const int& target = first;
	const std::int64_t& weight = second;
};
I am trying to rename first and second members of std::pair. How can I do it? The way I have done above does not work.
why?
Renaming them makes the code more readable and also prevents me from scrolling to the declaration every time.
struct Edge { int target; std::int64_t weight; };
there
I'll have to write the constructors myself :/
Edge edge{ t, w }; works
17:43
I can't do Edge edge1(edge2); without writing a constructor for it.
jey guys
it;s not related c++ but can u help me how to find max path in 2d array? like you have starting and end point and each cell contains positive number
nwp
nwp
@Yashas sure you can
and you have to find max k length path.you can move horizontally and vertically
I feel silly now. Thanks. Now I don't know what I was trying to do by inheriting pair.
Anyway if I wanted to rename members of a base class, how can I do it?
17:48
you can't
In the code I had sent earlier, what is const std::int64_t& weight = second; expected to do?
it's a const reference
to this.second, right?
Isn't that sort of renaming the members of the base class?
no because now you have reference member in your derived class
But that code as giving me garbage for some edges. If I changed target and weight to first and second, it would work.
17:50
goodbye compiler-generated assignment operator
@milleniumbug ?
Why was the assignment operator deleted?
7 mins ago, by milleniumbug
no because now you have reference member in your derived class
Why wasn't the copy constructor deleted?
18:00
> A defaulted copy assignment operator for class T is defined as deleted if any of the following is true:
T has a non-static data member of non-class type (or array thereof) that is const;
T has a non-static data member of a reference type;
Maybe the copy constructor was inherited from std::pair?
The implicitly-declared or defaulted copy constructor for class T is defined as deleted if any of the following conditions are true: (since C++11)

T has non-static data members that cannot be copied (have deleted, inaccessible, or ambiguous copy constructors);
T has direct or virtual base class that cannot be copied (has deleted, inaccessible, or ambiguous copy constructors);
T has direct or virtual base class with a deleted or inaccessible destructor;

T has a user-defined move constructor or move assignment operator;
IOW, reference member doesn't cause copy constructor to be deleted
What is the rationale behind having the default assignment operator deleted?
I have the opposite question: what is the rationale behind having copy constructor not deleted

« first day (593 days earlier)      last day (2484 days later) »