About Store Forum Documentation Contact



Post Reply 
The problem of search in Memc
Author Message
Babulesnik Offline
Member

Post: #1
The problem of search in Memc
I'm writing a class that is responsible for a list of all users who have been authorized.
When using Memc.find ()
Code:
bool FindUser(Str Login)
  {
      ColumnsUserList.Login=Login;
      if(MemUserList.find(ColumnsUserList))

      return true;
  }
error:
Code:
>          d:\microsoft visual studio 10.0\vc\include\esenthelengine\memory\mem continuous.h(43) : while compiling class template member function 'Int EE::Memc<TYPE>::find(const TYPE &) const'
1>          with
1>          [
1>              TYPE=StructColumnList
1>          ]

Сlass сode:
Code:
struct StructColumnsList
{
    Str Adress;
    Str    Login ;
    Str    Nick  ;
    Flt Money ;

}ColumnsUserList;

struct StructUserList  
{
  Memc<StructColumnsList>MemUserList;

  bool AddUser (Str &Adress , Str &Login , Str &Nick , Flt &Money )
  {
      ColumnsUserList.Adress =Adress;
      ColumnsUserList.Login  =Login ;
      ColumnsUserList.Nick   =Nick  ;
      ColumnsUserList.Money  =Money ;

      MemUserList.add(ColumnsUserList);

      return true;
  }
  bool FindUser(Str Login)
  {
      ColumnsUserList.Login=Login;
      if(MemUserList.find(ColumnsUserList))

      return true;
  }

  bool DeleteUser (Str &Login)
  {
    return true;
  }

}UserList;
I am not to understand that for a constant value should be there

I wrote my method,it works fine:
Code:
int FindUser(Str Login)
  {
      ColumnsUserList.Login=Login;

      FREPA(MemUserList)
      {
          if(T.MemUserList[i].Login==Login)return i;
      }

      return -1;
  }
But really want to understand why an error occurs when using the method of Memcsmilesmile
(This post was last modified: 08-07-2011 10:35 AM by Babulesnik.)
08-07-2011 10:19 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: The problem of search in Memc
probably you'd need to make StructColumnsList operator ==
08-11-2011 12:32 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #3
RE: The problem of search in Memc
(08-11-2011 12:32 PM)Esenthel Wrote:  probably you'd need to make StructColumnsList operator ==

The same error and memc <struct>. Save (File & file)

PHP Code:
struct StructRoomNormal // бесплатная комната для гуи клиента
{
    
Byte Number        ;
    
Str  NameRoom      ;
    
Str  PlayersInRoom ;
};
struct StructRoomsList //Kласс список комнат
{
  
Memc<StructRoomNormal>MemRoomsNormalList //список бесплатных комнат

  
StructRoomNormal RoomNormal 
...
...
  
bool ReturnNormalRooms File &) ;
}; 

If I try to compile the method of preservation. Save () I get an error
PHP Code:
bool StructRoomsList::ReturnNormalRoomsFile &)
  {
      
T.MemRoomsNormalList.save(f);
  } 
08-14-2011 12:19 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: The problem of search in Memc
you should check the source of MemRoomsNormalList.save

you're missing
void StructRoomNormal::save(File &f)
and
Bool StructRoomNormal::load(File &f)
08-16-2011 11:06 AM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #5
RE: The problem of search in Memc
(08-16-2011 11:06 AM)Esenthel Wrote:  you should check the source of MemRoomsNormalList.save

you're missing
void StructRoomNormal::save(File &f)
and
Bool StructRoomNormal::load(File &f)
Ie, that would keep all the lines the container MemRoomsNormalList I need to write code like this?

FREPA(MemRoomsNormalList)
{
MemRoomsNormalList[i].save(f)
}
08-17-2011 01:02 PM
Find all posts by this user Quote this message in a reply
Post Reply