I will copy stl vector container A to B
But not whole.
If element of A is proper, I will copy only that to B.
Is there any way to do it?

I tried to do this way.
1. newA.put_dat(input_stl[j].ino_no)
-------- ------------------------
B con A container
(ino_no element or whatever)
2. inputB_stl.push_back(newA_input);
But it was not working.

How can I do? Thanks you.

It is not entirely clear what you want to do, but if it is just copying specific elements of a container to another container, use the remove_copy_if() STL algorithm, along with a predicate that decides what it is you wish to not copy, and a back_insert_iterator<> to stick the results in the target container.

For example:

#include <algorithm>
#include <cctype>
#include <iostream>
#include <iterator>
#include <string>
using namespace std;

bool not_uppercase_nor_number( char ch )
  {
  // Remember, because the STL algorithm works by copying
  // everything except what we want, we want to list the
  // things we want in a negative way:
  return !(
      (isalpha( ch ) && isupper( ch ))
    || isdigit( ch )
    );
  }

int main()
  {
  string src = "Hello 1st there!";
  string dst;

  cout << "source = " << src << endl;

  // Copy all UPPERCASE letters and all DIGITS (but nothing else)
  remove_copy_if(
    src.begin(),
    src.end(),
    back_inserter( dst ),
    &not_uppercase_nor_number
    );

  cout << "result = " << dst << endl;

  return 0;
  }

You should see:

source = Hello 1st there!
target = H1

Hope this helps.

If element of A is proper

What is your definition of a "proper" element?

Thanks you a lot..

It is not entirely clear what you want to do, but if it is just copying specific elements of a container to another container, use the remove_copy_if() STL algorithm, along with a predicate that decides what it is you wish to not copy, and a back_insert_iterator<> to stick the results in the target container.

For example:

#include <algorithm>
#include <cctype>
#include <iostream>
#include <iterator>
#include <string>
using namespace std;

bool not_uppercase_nor_number( char ch )
  {
  // Remember, because the STL algorithm works by copying
  // everything except what we want, we want to list the
  // things we want in a negative way:
  return !(
      (isalpha( ch ) && isupper( ch ))
    || isdigit( ch )
    );
  }

int main()
  {
  string src = "Hello 1st there!";
  string dst;

  cout << "source = " << src << endl;

  // Copy all UPPERCASE letters and all DIGITS (but nothing else)
  remove_copy_if(
    src.begin(),
    src.end(),
    back_inserter( dst ),
    &not_uppercase_nor_number
    );

  cout << "result = " << dst << endl;

  return 0;
  }

You should see:

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.