[Insight-users] NumericSeriesFileNames

Luis Ibanez luis.ibanez at kitware.com
Sun Sep 25 12:53:32 EDT 2005


Hi Diego,

you are writing an unecessary "const" on the declaration:

          std::vector< std::string >   m_FileNames

If you declare this std::vector to be "const",
then you cannot assign any content to it...



The code that you need is like:



    typedef std::vector< std::string >  FilenamesType;

    const FilenamesType & names = nameGenerator->GetFileNames();

    FilenamesType myCopyOfNames;

    FilenamesType::const_iterator itr = names.begin();

    while( itr != names.end() )
      {
      myCopyOfNames.push_back( *itr );
      ++itr;
      }


By the end of the While loop, the container "myCopyOfNames"
will have the list of filesnames that were created in the
file generator.



    Regards,


        Luis


--------------------
Diego Parada wrote:
> Hi,
> 
> I need keep the file names that the NumericSeriesFileNames do in a const 
> std::vector<std::string>  m_FileNames
> but appears the folowing error:
> 
> C:\test\TID\src\TIDView.cpp(318) : error C2678: binary '=' : no operator 
> defined which takes a left-hand operand of type 'const class 
> std::vector<class std::basic_string<char,struct 
> std::char_traits<char>,class std::allocator<char> >,class std::allo
> cator<class std::basic_string<char,struct std::char_traits<char>,class 
> std::allocator<char> > > >' (or there is no acceptable conversion)
> Error executing cl.exe.
> 
> The code is:
> 
> const std::vector<std::string>  m_FileNames;
> m_FileNames = nameGenerator->GetFileNames();
> 
> -- 
> Diego Armando Parada Cuervo
> Estudiante de Ingeniería de Sistemas y Computación
> Universidad Pedagógica y Tecnológica de Colombia
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users




More information about the Insight-users mailing list