Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8879475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:57:30+00:00 2026-06-14T19:57:30+00:00

In header file, I declared the following as a public member variable: vector< vector<unsigned

  • 0

In header file, I declared the following as a public member variable:

vector< vector<unsigned char> > arImage;

In source code, I define temp

vector<vector<unsigned char> > temp (numImage, vector<unsigned char>(sizeImage));

Now I try to ,

temp.swap(arImage);

But an error occured. (detail errors are omitted because they are not English)

    with
    [
        _Ty=std::vector<unsigned char>
    ]

////////////
Addition,,,,,,,,

I want to swap

    vector<vector<unsigned char> > to vector<vector<unsigned char> >

I’m working with MFC. I can’t find proper method, so I actually take another approach.

In header file,

    vector< vector<unsigned char> > * arImage;

In source code,

    arImage = new vector< vector<unsigned char> > (numImage, vector<unsigned char>(sizeImage));

But this approach is not comfortable.(this approach is no error)

I want to use arImage[i][j].

In this approach, I have to use (*arImage)[i][j]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:57:31+00:00Added an answer on June 14, 2026 at 7:57 pm

    The thing you are doing wrong here is you are trying to swap vector< unsigned char > with vector of vector< unsigned char > which is not possible.

    Vector arImage has items of type unsigned char while temp type is vector<vector<unsigned char> > so temp items are vector<unsigned char>.

    So it make sense as can not swap vector<unsigned char> with unsigned char. Similarly you can not swap vector< unsigned char > with vector <vector< unsigned char >>.

    I hope it explains everything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

header file: private: vector<int*>* nums; public slots: void buttonClicked(); cpp file: NewWindow(){ int one
in header file I have defined the following function #ifndef OS_H #define OS_H #include
Consider having the following header file (c++): myclass.hpp #ifndef MYCLASSHPP_ #define MYCLASSHPP_ namespace A
Is everything declared within the braces following a class declaration in a header file
I have a variable declared in the header file : @interface int _nPerfectSlides; and
I found that some code won't work unless declared on the header file itself.
I have the following header file: #ifndef CLASSES_H #define CLASSES_H class Mouse // Handles
I have the following C Header/Code Example: Header file struct category_info { int id;
can we declare a function in a header file in following way? extern int
I've declared a struct in my header file like this: typedef struct { NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.