Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [C++/CLR] Problema espressione lambda

    Ho la classe:

    codice:
    /* .hpp */
    class MCIDaMS
    {
    	typedef struct MTIDAITEM 
    	{
    		...
    
    	} mtidaitem_t;
    
    
    	typedef std::tr1::unordered_map<const char *, mtidaitem_t> umap_t;
    	umap_t data_container;
    
    	void WriteItem(mtidaitem_t &item);
    	bool Save(const char *file_path);
    };
    
    
    /* .cpp */
    bool MCIDaMS::Save(const char *file_path)
    {
    	...
    		
    	std::for_each(data_container.begin(), data_container.end(), 
    		[this] (std::pair<const char *, mtidaitem_t> item) { WriteItem(item.second); });
    
    	...
    }

    che non mi da problemi se la utilizzo in un progetto c++ "standard". tuttavia se importo la classe in un progetto CLR il compilatore inizia a darmi un bel po di errori nell'espressione lambda del metodo MCIDaMS::Save, del tipo:



    codice:
    2>MIDaMS.cpp(56): error C2059: syntax error : '['
    2>MIDaMS.cpp(56): error C2143: syntax error : missing ')' before '{'
    2>MIDaMS.cpp(56): error C2143: syntax error : missing ';' before '{'
    2>MIDaMS.cpp(56): error C2065: 'item' : undeclared identifier
    2>MIDaMS.cpp(56): error C2228: left of '.second' must have class/struct/union
    2>          type is ''unknown-type''
    2>MIDaMS.cpp(56): error C2059: syntax error : ')'

    Qualcuno sa spiegarmi il perchè?
    Grazie
    Fracty - The Fractal Generator



    If you cannot choose a concise name that expresses what the method does, it is possible that your method is attempting to perform too many diverse tasks.

  2. #2
    Problema di framework risolto
    Fracty - The Fractal Generator



    If you cannot choose a concise name that expresses what the method does, it is possible that your method is attempting to perform too many diverse tasks.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.