无效的显式模板参数xmemory()

时间:2018-01-14 08:48:36

标签: c++ memory-management

前面提到的错误(C2770)已经加剧了xmemory()文件以及其他类似文件 错误C2825'_Ty':后跟'::'时必须是类或命名空间。我在这里和那里发现了一些关于这样的错误但是没有关于xmemory()的问题,特别是我无法编辑它...

错误来自下面的结构声明(变量)。问题在于enum(s)CompositionMaterials和EquipmentSpecs,它们分别声明如下(

enum EquipmentSpecs{
    LNGColdOutletTemp=1,
    LNGHotOutletTemp=2,
};
//If you ever added any new compositions below, make sure to register them also in HYSYSCompositionsMap with their equivalent HYSYS names
enum CompositionMaterials{
    Nitrogen=1,
    Methane=2,
    Ethane=3,
    Propane=4,
    iButane=5,
    nButane=6,
    Water=7,
};
enum DecisionVariable{
MolFlow=1,
Pressure=2,
Temperature=3,
Composition=4,
EquipmentSpec=5,
};
struct Variable{
string StreamOREquipmentName; 
DecisionVariable TypeOfVar;
double MaxBound;
double MinBound;
CompositionMaterials Constituent; //IF TypeOfVar is Composition
EquipmentSpecs Spec; //IF TypeOfVar is EquipmentSpec
double BaseValue; //Used to reset the case in case of a problem occured in last runs
};
vector<Variable> DecVar;

错误在xmemory()文件的以下几行中报告:

        // TEMPLATE STRUCT _Get_rebind_type
template<class _Ty,
    class _Other>
    struct _Get_rebind_type
    _GET_TYPE_OR_DEFAULT(template rebind<_Other>::other,
        typename _Replace_first_parameter<_Other _COMMA _Uty>::type);

以下部分是使用上述变量的地方

else if( (DecVar[ ii ].TypeOfVar == EquipmentSpec) && (DecVar[ ii ].Spec == LNGColdOutletTemp) ){

            //This means that the variable is outlet cold temperature of LNG operation, u loop through equipment and set outlet temperature of hot streams to this particular value { gene(i) }
            for( j = 0; j < OperationsCount; j++ ){
                _variant_t t = _variant_t( j );
                Connection.GetOperation( t );
                IDispatch* hyOp = Connection.hyOperation;
                string name = Connection.GetName( hyOp );
                if( name == DecVar[ ii ].StreamOREquipmentName ){
                    int Feeds = Connection.GetOperationFeedCount( hyOp );
                    int Products = Connection.GetOperationProductCount( hyOp );
                    if( Feeds != Products ){
                        cout << "Discrepency between feed count and product count of an LNG, error in source 1603" << endl;
                        return OOPS;
                    }
                    for( int C = 0; C < Feeds; C++ ){
                        IDispatch* ThisIndexFeedStrm;
                        IDispatch* ThisIndexProductStrm;
                        ThisIndexFeedStrm = Connection.GetOperationFeedStream( _variant_t( C ) );
                        ThisIndexProductStrm = Connection.GetOperationProductStream( _variant_t( C ) );
                        double FeedTemp = Connection.GetTemperature( ThisIndexFeedStrm );
                        double ProductTemp = Connection.GetTemperature( ThisIndexProductStrm );
                        if( ( FeedTemp == ProductTemp ) || ( FeedTemp == NAN ) || ( ProductTemp == NAN ) ) {
                            cout << "You got a useless LNG operation, error in source 1656" << endl;
                        }
                        else if( FeedTemp < ProductTemp ){
                            //This means it is a cold stream
                            Connection.SetTemperature( ThisIndexProductStrm, genome1.gene( ii ) );

                        }
                    }
                }
            }

        }

0 个答案:

没有答案