Saving arrays in EEPROM using ARDUINOMEGA

The "readAnything", is not working prop...

This is my code:

#include <EEPROM.h>
template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
    const byte* p = (const byte*)(const void*)&value;
    int i;
    for (i = 0; i < sizeof(value); i++)
	  EEPROM.write(ee++, *p++);
    return i;
}

template <class T> int EEPROM_readAnything(int ee, T& value)
{
    byte* p = (byte*)(void*)&value;
    int i;
    for (i = 0; i < sizeof(value); i++)
	  *p++ = EEPROM.read(ee++);
    return i;
}
void setup()
{
  Serial.begin(9600);
  int reference = 323;
  int gas = 1234;
  int serial;
  int serial1;
  
  
    EEPROM_writeAnything(0, reference);
    serial = EEPROM_readAnything(0,reference);
    
   
   Serial.print(serial);
    
    
}
void loop()
{
    
}

2 is displayed now.

Does it work properly???