Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Complier error C2280 explanation

Complier error C2280 explanation

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpvisual-studiotools
7 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi I have the following collection class (referencing a struct) which is causing the complier error listed below I ended writing my own link list becuase I couldnt resolve the issue however I am hoping that by posting this someone can maybe explain it to me so here is the code listed below is the complier error for some reason the complier doesnt like a Clist template in a struct

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxtempl.h(954,17): error C2280: 'CStorge::buildcombo::tcbholder &CStorge::buildcombo::tcbholder::operator =(const CStorge::buildcombo::tcbholder &)': attempting to reference a deleted function

    struct stdecs
    {
    struct vsmdesc stordesc;
    char* tcb;
    struct blkdesc *ablkdescx;
    struct blkdesc *fblkdescx;
    struct stdecs* nextdecs;

    };
    struct tcbholder
    {  
    	char\* tcb;
    	char programname\[8\];
    	struct stdecs \*storageptr;
    	CList stptr;
    
    };
    
    CPalliniC 1 Reply Last reply
    0
    • F ForNow

      Hi I have the following collection class (referencing a struct) which is causing the complier error listed below I ended writing my own link list becuase I couldnt resolve the issue however I am hoping that by posting this someone can maybe explain it to me so here is the code listed below is the complier error for some reason the complier doesnt like a Clist template in a struct

      C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\atlmfc\include\afxtempl.h(954,17): error C2280: 'CStorge::buildcombo::tcbholder &CStorge::buildcombo::tcbholder::operator =(const CStorge::buildcombo::tcbholder &)': attempting to reference a deleted function

      struct stdecs
      {
      struct vsmdesc stordesc;
      char* tcb;
      struct blkdesc *ablkdescx;
      struct blkdesc *fblkdescx;
      struct stdecs* nextdecs;

      };
      struct tcbholder
      {  
      	char\* tcb;
      	char programname\[8\];
      	struct stdecs \*storageptr;
      	CList stptr;
      
      };
      
      CPalliniC Offline
      CPalliniC Offline
      CPallini
      wrote on last edited by
      #2

      CList features a deleted copy contructor. Microsoft folks think it is not useful to pass collections by value. You could use std::list instead (I believe Microsoft folks themselves recommend std::list over CList).

      "In testa che avete, Signor di Ceprano?" -- Rigoletto

      In testa che avete, signor di Ceprano?

      F 1 Reply Last reply
      0
      • CPalliniC CPallini

        CList features a deleted copy contructor. Microsoft folks think it is not useful to pass collections by value. You could use std::list instead (I believe Microsoft folks themselves recommend std::list over CList).

        "In testa che avete, Signor di Ceprano?" -- Rigoletto

        F Offline
        F Offline
        ForNow
        wrote on last edited by
        #3

        Thanks let me look it up

        CPalliniC 1 Reply Last reply
        0
        • F ForNow

          Thanks let me look it up

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          You are welcome.

          "In testa che avete, Signor di Ceprano?" -- Rigoletto

          In testa che avete, signor di Ceprano?

          F 1 Reply Last reply
          0
          • CPalliniC CPallini

            You are welcome.

            "In testa che avete, Signor di Ceprano?" -- Rigoletto

            F Offline
            F Offline
            ForNow
            wrote on last edited by
            #5

            Still get error with list me thinks it has to do that I declared stdecs just as a type without actually allocating storage i.e struct stdecs storagediscriptor; when I have the template outside of a struct it compiles thanks

            CPalliniC 1 Reply Last reply
            0
            • F ForNow

              Still get error with list me thinks it has to do that I declared stdecs just as a type without actually allocating storage i.e struct stdecs storagediscriptor; when I have the template outside of a struct it compiles thanks

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              This works for me:

              #include #include using namespace std;

              struct Foo
              {
              list foolist;
              };

              int main()
              {
              Foo f1;
              f1.foolist.push_back(5);
              f1.foolist.push_back(7);
              Foo f2 = f1;
              for (auto i: f2.foolist)
              cout << i << " ";
              cout << "\n";
              }

              "In testa che avete, Signor di Ceprano?" -- Rigoletto

              In testa che avete, signor di Ceprano?

              F 1 Reply Last reply
              0
              • CPalliniC CPallini

                This works for me:

                #include #include using namespace std;

                struct Foo
                {
                list foolist;
                };

                int main()
                {
                Foo f1;
                f1.foolist.push_back(5);
                f1.foolist.push_back(7);
                Foo f2 = f1;
                for (auto i: f2.foolist)
                cout << i << " ";
                cout << "\n";
                }

                "In testa che avete, Signor di Ceprano?" -- Rigoletto

                F Offline
                F Offline
                ForNow
                wrote on last edited by
                #7

                Get clean build seems to do more than clist thanks

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups