std::set In C++

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 189

  • @ryklin1
    @ryklin1 3 ปีที่แล้ว +2

    This is esoteric because normally you would write a compare function and pass it to std::sort() but because this is a std::set and gets sorted at insertion, we need to specify the compare operator as part of the class and even explicitly during instantiation of the object. This is good to know thanks

  • @SuperLordee
    @SuperLordee 5 ปีที่แล้ว +11

    Hey Rupesh just because no one told you, Jhon is written wrong. John is the correct way to write the name. :)

    • @jinisha6485
      @jinisha6485 4 ปีที่แล้ว +1

      @SuperLordee Heyy....Ik it’s usually john but jhon is also a name:)

  • @pranngowda80
    @pranngowda80 3 ปีที่แล้ว

    superbb explanation ...! set< int , greater > for descending order

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Yes, correct

  • @kailas813
    @kailas813 4 ปีที่แล้ว +4

    Hi Rupesh,
    Detailed explanation. Your teaching style so understandable. Thank you.
    I have one doubt which not related to this "set" topic.
    A general one.
    At the starting of the program, "using namespace std;" is used. So do we need to mention std here - > "std::greater / std::less " ?
    I apologize for this my doubt is not relevant to this topic discussed.

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +2

      It is good question.
      No you don't have to specify explicitly.

  • @emanueleoggiano
    @emanueleoggiano 5 ปีที่แล้ว +11

    Hi CppNuts, if you can do it, can you make some videos or maybe an entire playlist about boost libraries?
    Maybe a video about how to install them on Windows and Linux and some other videos about how to use the boost libraries.
    Thanks for the Stl playlist, I am learning a lot of new things

  • @aadarshraj5859
    @aadarshraj5859 2 ปีที่แล้ว +1

    Great explanation. Thanks to you

  • @christopherapps6177
    @christopherapps6177 5 ปีที่แล้ว +5

    Thanks cppnuts.. we are eager to learn Stl from your video teachings..

    • @CppNuts
      @CppNuts  5 ปีที่แล้ว

      Thanks for all your support.. 😊

  • @hong-wenwang896
    @hong-wenwang896 3 ปีที่แล้ว +7

    Bro your sound is amazing funny and attractive, keep going !

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Thanks 👍

  • @lamebrisee
    @lamebrisee 4 ปีที่แล้ว +26

    so clear and enjoyable ! :-) thanks a million

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      Thanks man!!

  • @Andrei-ds8qv
    @Andrei-ds8qv 4 ปีที่แล้ว +4

    Damnn I love those videos, they are really in depth and so damn clear!! Thanks a lot for your time man!

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      Thanks for the comment!!

  • @avishekdutta1901
    @avishekdutta1901 4 ปีที่แล้ว +2

    Sir plzz explain the bool comparator part!!!!!

  • @marcofe82
    @marcofe82 2 ปีที่แล้ว

    Rupesh, thank you so much for this lesson. I've appreciated a lot it!

  • @kishorjha5028
    @kishorjha5028 3 ปีที่แล้ว

    wow clear my all concept thnxxxx sir

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Glad to hear that

  • @sirikondadurgaprasad1447
    @sirikondadurgaprasad1447 2 ปีที่แล้ว +1

    thank you so much sir ,it is very useful at the time of examinations..

  • @sai6948
    @sai6948 5 ปีที่แล้ว +5

    could you explain me the for loop syntax that you have used in this video.

    • @CppNuts
      @CppNuts  5 ปีที่แล้ว +5

      It is call range based for loop.
      th-cam.com/video/dvaqLnbdEcM/w-d-xo.html
      Here is my video on this topic, and i have compared it with normal loop.

    • @solosam1232
      @solosam1232 4 ปีที่แล้ว

      😊

  • @karthickraj6580
    @karthickraj6580 4 ปีที่แล้ว +8

    What if I want insert the new "Person" with the same age, which is already existed in the list, Ex: 30, "Raj", will this set allow?

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +11

      No, same age is not allowed.
      Once you have 30, Rupesh then you can't have 30 Hitesh.

    • @spyrex3988
      @spyrex3988 2 ปีที่แล้ว

      @@CppNuts does not a different string make that an another unique object tho?

  • @tarakhanal1864
    @tarakhanal1864 4 ปีที่แล้ว +1

    Thank you very much for this explanation. The operation overloading part wasn't so clear but you explained the concept of Set very well. You earned a subscriber and deserve many more. Keep uploading great content, Rupesh!

  • @ku4etomi
    @ku4etomi 3 ปีที่แล้ว +4

    Thank you so much for creating this video! It was very clear, easy and enjoyable! Good luck and you've won me as a subscriber :)

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Glad it was helpful!

  • @SonuKumar-kj6uz
    @SonuKumar-kj6uz 4 ปีที่แล้ว +1

    Sir excellent content.

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      Thanks a ton

  • @bondok69
    @bondok69 4 ปีที่แล้ว

    Very good informational tutorial.

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      Glad it was helpful!

  • @calmquoties
    @calmquoties 2 ปีที่แล้ว

    Thank you man! Easy to understand!

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว +1

      Glad it helped!

  • @bruteforceman2311
    @bruteforceman2311 4 ปีที่แล้ว

    Bro you are the best 😊

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      You are the best

  • @ForCodingInterview
    @ForCodingInterview 3 ปีที่แล้ว

    More info and a clear explanation. You're the best in doing this.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Glad you think so!

  • @Durgasivakumaran
    @Durgasivakumaran 3 ปีที่แล้ว

    Lovely expln... 👌🏻

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Thanks a lot 😊

  • @balajianbalagan7467
    @balajianbalagan7467 3 ปีที่แล้ว

    Bro awesome video but can u do a vifeo for how to define a custom comparison operator...😅

  • @khaledelgharbi5200
    @khaledelgharbi5200 3 ปีที่แล้ว

    Great teacher! Thank you for the videos

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      My pleasure!

  • @spyrex3988
    @spyrex3988 2 ปีที่แล้ว

    i have 2 questions:
    1)what do the asscociative container ASSOCIATE those sorted values to?
    2) what is "const auto& e" ?

  • @bhupeshpattanaik7150
    @bhupeshpattanaik7150 3 ปีที่แล้ว +5

    0:57 the syntax used in for loop is valid in C++14 ?.... Extremely nice explaination 👌 and ajj pata chala app INDIAN ho 😂😍

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +2

      Thanks dude..

  • @ishaankelkar7521
    @ishaankelkar7521 2 ปีที่แล้ว

    Thank you for the great content!

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Thanks

  • @dhanushambrose4179
    @dhanushambrose4179 4 ปีที่แล้ว

    sir ,don't how you used for loop in program
    for(const auto&e: Set){
    cout

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      This is called range based for loop, google it.

    • @dhanushambrose4179
      @dhanushambrose4179 4 ปีที่แล้ว

      @@CppNuts thank you

  • @maxim25o2
    @maxim25o2 3 ปีที่แล้ว

    Now I know why OPERATOR in C++ exist and what purpose it have.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Great..

  • @advikas6484
    @advikas6484 3 ปีที่แล้ว

    best in class !

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Thanks..

  • @sarthakbharadwaj5576
    @sarthakbharadwaj5576 4 ปีที่แล้ว

    What did you do with that bool???
    And what's the syntax for templates in greater???

  • @ravikiran6645
    @ravikiran6645 4 ปีที่แล้ว +2

    what does bool operator()(const Person& rhs) const do ?? if its "()" ?

    • @abbasjradi5001
      @abbasjradi5001 3 ปีที่แล้ว

      i'd like to know too!!

    • @spyrex3988
      @spyrex3988 2 ปีที่แล้ว

      its been a year did u find out?

  • @mdirshadalam2617
    @mdirshadalam2617 4 ปีที่แล้ว +1

    Hi Rupesh,
    why set is not sorted Person object on the basis of name(2nd argument),why on the basis of age(first argument)?
    Is it possible to sort the set on the basis of 2nd argument?

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +2

      Yes you can do it, you just need to use name instead of age.

    • @mdirshadalam2617
      @mdirshadalam2617 4 ปีที่แล้ว

      @@CppNuts Thanks Rupesh.

  • @suniljaiswal2471
    @suniljaiswal2471 4 ปีที่แล้ว +1

    hey man,
    is there any container that provides uu-order feature such that order should not change at all ,if i am taking 7,3,1,4,2,9,10.....it should print exactly same 7,3,1,4,2,9,10?

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      Array, list, vector

  • @KNT_19
    @KNT_19 3 ปีที่แล้ว

    Why set is called as associative container? Because there is no pair of key-value while storing data in set. This was asked in an interview.

  • @chiadong5699
    @chiadong5699 4 ปีที่แล้ว +2

    for the bool operator < function, the age belongs to which object and rhs takes reference to which object?Thankyou very much

    • @preetikhanna7034
      @preetikhanna7034 4 ปีที่แล้ว

      age is Left Hand side data member and rhs.age is datamember of Right hand side .

  • @__ra.hul__
    @__ra.hul__ 3 ปีที่แล้ว

    sir which ide you use for coding.

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      VS Code.

  • @armanbhuiyan8741
    @armanbhuiyan8741 4 ปีที่แล้ว +1

    in the example , you have showed there the set is initiated . What if the set is not initiated? How can I input set from console ??

  • @LearningYouth
    @LearningYouth 3 ปีที่แล้ว

    Thanks

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Welcome

  • @SRISAISOUSAR
    @SRISAISOUSAR 5 ปีที่แล้ว +1

    which ide are you using, can it be used on windows 10

    • @CppNuts
      @CppNuts  5 ปีที่แล้ว

      This is VS Code.
      I use sublime also.

    • @darkinferno4687
      @darkinferno4687 4 ปีที่แล้ว

      it's an editor not an IDE
      and it's cross platform

  • @ryklin1
    @ryklin1 2 ปีที่แล้ว +1

    There's a risk to this code, if you enter two Persons with the same age, the second person will not be entered into the set because it will be considered a duplicate because of the age variable. So, how can we write the code to recognize that the constructor variables are different?

    • @domenicoscarpelli5685
      @domenicoscarpelli5685 ปีที่แล้ว

      Hi @ryklin1 I come across your answer. Simply add an or condition in the operator function like this:
      bool operator < ( const Person & rhs ) const { return ( age < rhs.age || name < rhs.name); }
      it should work.

  • @karthickkumar1380
    @karthickkumar1380 3 ปีที่แล้ว

    God You;

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Thanks dude..

  • @rakibulislam2452
    @rakibulislam2452 4 ปีที่แล้ว

    are you overloading < operator?

  • @shreyasvishwakarma8979
    @shreyasvishwakarma8979 4 ปีที่แล้ว

    I didn't understood how you used bool operator and what is this Person& rhs. Please explain .

  • @codingminer535
    @codingminer535 4 ปีที่แล้ว +3

    can any one tell me where i can read about this i didn't understand this .....
    bool operator < (const Person& rhs) const {return age

    • @mehulchavda7712
      @mehulchavda7712 4 ปีที่แล้ว +2

      i dont know where you can read it, but here is my explanation....
      greater is a tamplate class it self, now it has all operator overloaded into it, but they have used ascending logic, now if you want to use descending logic then you write your own greater function, and as data type of greater is Person it will take our provided logic instead of its own logic.
      and in this line bool operator < (const Person& rhs) const {return age y) swap;
      here that if condition will be replaced by ( age < rhs.age)
      remeber we needed to do that because we are giving user defined data type otherwise you would not have to give this bool operator < (const Person& rhs) const {return age

    • @gilbertgalvan6046
      @gilbertgalvan6046 4 ปีที่แล้ว +2

      Search "Operator Overloading C++"

  • @prathameshkodgire8642
    @prathameshkodgire8642 3 ปีที่แล้ว

    9:25 its john bro , but great content

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Thanks man.

  • @eduardo9163
    @eduardo9163 4 ปีที่แล้ว +1

    I swear computer science is over kill. You Write a bunch of lines to console out a line lol

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      This is life.. :D

    • @eduardo9163
      @eduardo9163 4 ปีที่แล้ว +1

      @@CppNuts what books do you reccomend

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +2

      @@eduardo9163 well when i was in college they gave me some book and that time i didn't know english so it was like understanding english first and then programming. And when i understood english i never red any programming book. It just internet and stuff.
      But i what i more emphasis is if you are beginner then just do some pattern printing and some other small programs. That should clear the doubts how to use your programming language and do what you want.

  • @kaizenalive
    @kaizenalive 4 ปีที่แล้ว

    In 10:45 you did operator overloading..
    can you explain why you have used 'const' in that line.. or what's the role of 'const' there..
    you have used it twice in that line..

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      I have used Constant to says that I will not modify if I am receiving with reference

  • @yashchauhan5852
    @yashchauhan5852 3 ปีที่แล้ว

    Correct me if i am wrong. If we have raw pointers as data members in our class, then we have to overload "operator==" because if we don't, the compiler will compare the pointer and not what it is pointing to and hence store it in the set, right?

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Yes, you have to, because as it is not integral data types it's a user defined data type, which requires a way from user to be given that how to compare it. (And Set would need to know how to compare two elements in-order to place them according)

    • @yashchauhan5852
      @yashchauhan5852 3 ปีที่แล้ว

      @@CppNuts yup, so we have to overload > and ==

    • @yashchauhan5852
      @yashchauhan5852 3 ปีที่แล้ว

      @@CppNuts Never knew there was such a great channel on TH-cam. Keep growing 💪

  • @DarshanGhorpade7
    @DarshanGhorpade7 ปีที่แล้ว

    Hey, how can I implement set class using templates, I want to write the methods, that I have done, not getting the idea about how to implement iterator for this

  • @devaciustheoneaboveall1389
    @devaciustheoneaboveall1389 4 ปีที่แล้ว

    Man the video was great why do you so many ads . They suckkk!!!

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      It depends on TH-cam how many ads should come. Sorry for the inconvenience.

  • @jan-hendrikvoss4879
    @jan-hendrikvoss4879 4 ปีที่แล้ว

    Good job mate!

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      Thank you! Cheers!

  • @solosam1232
    @solosam1232 4 ปีที่แล้ว

    Pls. Explain Comparator and how we can define them in cpp file!!!!

  • @kathakar_piyush1395
    @kathakar_piyush1395 2 ปีที่แล้ว

    Is any efficient way to insert a range of consecutive integers in a set ? If Yes then How?

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      you can pass iterator or array / vectors to set and it will automatically insert everything from vector or array.

  • @ADNANAHMED-eo5xx
    @ADNANAHMED-eo5xx 3 ปีที่แล้ว

    Thnks man

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      Happy to help

  • @mananmehta2320
    @mananmehta2320 4 ปีที่แล้ว

    Can somebody explain the loop const auto &e. Why it is const? And why we are reference variable?

  • @bharataaryavrat4067
    @bharataaryavrat4067 4 ปีที่แล้ว

    What will be time complexity of getting
    --set. end() iterator

  • @ameerkhusroo6192
    @ameerkhusroo6192 4 ปีที่แล้ว

    can you explain in line 25 why you are using " const" and " & rhs"

    • @darkinferno4687
      @darkinferno4687 4 ปีที่แล้ว +4

      it's not mandatory, just a good practice.
      const makes the object immutable at compile time
      since we're just comparing the objects and wont change the values we use const
      rhs is the object which will be on the right hand side. u can call it anything. but people usually use this notation for operator overloading.
      &rhs is the reference(address) of rhs. read Pass by Reference. ur not passing the actual variable but and address to the variable.
      This along with the const wont have significant effects on small programs but good practice is definitely makes a difference in large programs.

    • @ameerkhusroo6192
      @ameerkhusroo6192 4 ปีที่แล้ว

      @@darkinferno4687 thanks

  • @sathishkumar-dc9ce
    @sathishkumar-dc9ce 4 ปีที่แล้ว

    can anyone explain what is this return{age

  • @rohitangiras6476
    @rohitangiras6476 4 ปีที่แล้ว +2

    Hey, @CppNuts Can you please spare little time to explain how the line 25 26 functions. Thanks

  • @neghatnazir1668
    @neghatnazir1668 4 ปีที่แล้ว +1

    hey! thankyou this explinantion teaches me a lot of things! i really liked it

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      Glad it was helpful!

  • @bryanmatthew6106
    @bryanmatthew6106 2 ปีที่แล้ว

    If the data members in a user defined data type are private, do we pass the information the same way?
    class Person {
    private:
    float age;
    string name;
    public:
    };

    • @bryanmatthew6106
      @bryanmatthew6106 2 ปีที่แล้ว

      Still like this when the data members are private?
      set Set = { {30, “Rupesh”}, {25, “Hitesh”}};
      Also, what if we have many float data members, that means it will take our input based on the order we declare the float data members in class?

  • @prathaps2753
    @prathaps2753 4 ปีที่แล้ว +1

    hey dude make some videos on setuping vs code for c++

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      I believe there are so many videos for the same.

  • @saurabhpandey5606
    @saurabhpandey5606 4 ปีที่แล้ว

    very well explained

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      Glad you think so!

  • @ohmnamo7056
    @ohmnamo7056 4 ปีที่แล้ว +1

    hi bro thanks for the video.I have one doubt you are using set variable called Set. How 3 data of age and name are stored inside the same set without creating 3 different object name?
    my understanding is are you overwriting the age and name variable with different data?

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      Didn't get the question.

    • @ohmnamo7056
      @ohmnamo7056 4 ปีที่แล้ว

      @@CppNuts Thanks for replying... I mean you told that {30,"Rupesh},{25,"Hitesh"},{22,"jhon"}, are three objects. is that object or data?

  • @maxhitup
    @maxhitup 3 ปีที่แล้ว

    could you please explain 25 line of code

  • @pritamchakraborty6159
    @pritamchakraborty6159 4 ปีที่แล้ว

    bool operator < (const Person& rhs) const {return age< rhs.age;}
    can you please explain why "const {...}" -> const is used? what is the need to use that?

  • @youssofprogrammer7546
    @youssofprogrammer7546 2 ปีที่แล้ว

    thanks very much but i didn't understand what is the ' rhs ' word that you wrote it minute(10:50)

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว +1

      Right hand side

    • @youssofprogrammer7546
      @youssofprogrammer7546 2 ปีที่แล้ว +1

      @@CppNuts What do you mean by Right hand side

    • @youssofprogrammer7546
      @youssofprogrammer7546 2 ปีที่แล้ว +1

      @@CppNuts please if you can answer me i need that

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      You can use “obj” instead of rhs, it’s nothing.

  • @krishshah3974
    @krishshah3974 3 ปีที่แล้ว

    so nicely explained! Thank you so much! :D

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Glad it was helpful!

  • @Santhosh-py8he
    @Santhosh-py8he 4 ปีที่แล้ว

    What is the use of lines 25,26 in the code , and you haven't made any explanation regarding those two lines(not the const part , it is the bool part)! I haven't understood what is being done there....!!! respond ASAP!!!!

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      Learn operator overloaded.
      I have videos for that..

  • @mandyratta6970
    @mandyratta6970 4 ปีที่แล้ว

    I got the for loop syntax.But Why did you use const keyword in the loop..

  • @rahulsharma-we4tz
    @rahulsharma-we4tz 4 ปีที่แล้ว

    excellent tutorial,thank you

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      Glad you liked it

  • @prakad97
    @prakad97 5 ปีที่แล้ว

    Ok now..how to take a particular set using a given value. For eg..given 22 I need the whole object back..how to do it?

    • @CppNuts
      @CppNuts  5 ปีที่แล้ว +3

      You can a function like:
      getValue(index) {
      int count = 0;
      if(index

  • @anonymous4030
    @anonymous4030 2 ปีที่แล้ว

    Why we have used const in the loop??

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Compiler does some kind of optimization, if we tell that the parameter is const.

  • @fardinanamaungon8890
    @fardinanamaungon8890 4 ปีที่แล้ว

    I don't know why I am getting this error even after writing the same code as you have written!!
    The error message is actually huge. Here is a small part of it:
    D:/CodeBlocks/MinGW/lib/gcc/mingw32/5.1.0/include/c++/bits/stl_function.h:387:20: note: 'const Person' is not derived from 'const std::tuple'
    { return __x < __y; }

    • @fardinanamaungon8890
      @fardinanamaungon8890 4 ปีที่แล้ว

      However, making the overloaded function as friend works fine

  • @joshuamahadevan9550
    @joshuamahadevan9550 3 ปีที่แล้ว

    RIP jhon😂😂 it shld be joh.lol

  • @anuragtiwari9793
    @anuragtiwari9793 3 ปีที่แล้ว

    Why are you using std:: everywhere if you'd write using namespace std at the beginning?????

  • @alina8023
    @alina8023 4 ปีที่แล้ว

    what is bool operator

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      std::set needs some way to compare one object with another object because it has to create a tree inside and place these objects accordingly, so if you compare obj1

  • @pulkitraj775
    @pulkitraj775 4 ปีที่แล้ว

    Why "pair" is not a Associative Container ?? 🧐🧐

  • @manukrishna1280
    @manukrishna1280 3 ปีที่แล้ว

    Can you just describe about 'for(const auto&e: Set)'

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      whatever Set will hold would come one by one in "e" and in loop we can process "e", just like traditional loop.

  • @lovishagrawal7453
    @lovishagrawal7453 4 ปีที่แล้ว

    why did they write const in front of return statement and in front of person& rhs
    bool operator < (const Person& rhs) const {return age < rhs.age;}

  • @DebateSunday
    @DebateSunday 2 ปีที่แล้ว

    while compiling, i get this error - non-aggregate type 'set' cannot be initialized with an initializer list
    set Set = {1,2,5,4,3,1,2,3,4,5};
    ^ ~~~~~~~~~~~~~~~~~~~~~

    • @CppNuts
      @CppNuts  2 ปีที่แล้ว

      Try online compiler, don't know why this error.

  • @udbhavvikramsingh3449
    @udbhavvikramsingh3449 3 ปีที่แล้ว

    I did not understand bool operator .......................................... syntex.
    what is this? plz someone explain.

  • @nayangupta5843
    @nayangupta5843 3 ปีที่แล้ว

    What is rhs here?

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      Right hand side

  • @who_dunnit
    @who_dunnit 4 ปีที่แล้ว

    could the comparator compare strings? Like where we used age to compare, could we use their name?

  • @Shobha1120
    @Shobha1120 3 ปีที่แล้ว

    How is the initializer list for the "Person" class working without a parametrized constructor in the class?

  • @ankitthakar2671
    @ankitthakar2671 5 ปีที่แล้ว +1

    Is it possible that you can share the file which are using for explanation?

  • @sudiptasen5212
    @sudiptasen5212 3 ปีที่แล้ว

    In the line "for {const auto& e: Set}" while "Set" contains integer value then also "&" is used with "auto". I checked that the similar code will also work if "&" is removed. Then why will we give "&"? If "Set" contains string variable then also both with and without "&" the iteration will work. Can you please explain why there is an "&" needed, or if it "&" is not mandatory then what is the benefit of using it?

  • @alshohb
    @alshohb 2 ปีที่แล้ว

    John *

  • @himanshupatel4063
    @himanshupatel4063 4 ปีที่แล้ว

    can anyone tell me how is writing on the screen.

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      Secret :P

    • @pritamchakraborty6159
      @pritamchakraborty6159 4 ปีที่แล้ว

      step 1: write down code in vs code,
      step 2: take a screenshot of that.
      step 3: import the screenshot in "openboard" s/w( or any digital board you like ) and explain whatever you want to explain.
      To Know More Check Out: th-cam.com/video/3xlPxKzQiWU/w-d-xo.html

  • @mohitchoudhary4255
    @mohitchoudhary4255 4 ปีที่แล้ว

    Hi, Your video is really good, but one thing why are you trying to make western accent.

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +1

      When i am in good mood sometime it happens.

  • @MahimDashoraHackR
    @MahimDashoraHackR 4 ปีที่แล้ว +1

    I think in c++ 98 some things don't work, like direct assigning values to vector instead of push_back.

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว

      Like what?

  • @nas5834
    @nas5834 4 ปีที่แล้ว

    its john not jhon :p

  • @parthkatlana1252
    @parthkatlana1252 4 ปีที่แล้ว +1

    Enough with the greed, reduce the number of adds to 1. SERIOUSLY!!

    • @CppNuts
      @CppNuts  4 ปีที่แล้ว +5

      Instead of paid courses, you are getting knowledge about few products in the market if you watch ads and thats all it takes to get it free. I would say it is a good deal. :P

    • @parthkatlana1252
      @parthkatlana1252 4 ปีที่แล้ว +2

      @@CppNuts Fair👍🏻

  • @anshumalibhardwaj8082
    @anshumalibhardwaj8082 3 ปีที่แล้ว

    please drop your accent it is irritating

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว +1

      :D can't..

  • @ayashukothiyal3320
    @ayashukothiyal3320 3 ปีที่แล้ว

    whats with the fake accent tho

    • @CppNuts
      @CppNuts  3 ปีที่แล้ว

      how do you recognize b/w fake and real?