// RuntimeForStatic base library | C+- (SysRoutine) | Author: Sergei Y.Kitáev
#pragma once
#include "include_restrictions.h"
namespace RuntimeForStatic {
//==================================================================================================

template<typename T>static T* $ops::Clean(T& location) $ret_target
{
   return (T*)$memory::Clear($, &location );
}

//--------------------------------------------------------------------------------------------------

template<typename T>static bool $ops::IsOneOf(T value,const std::initializer_list<T>& list)
{
   for (auto val: list)
      if ( val == value )
         return true;
   return false;
}

template<typename T>static bool $ops::IsBetween(T value,T from,T to)
{
   return value >= from && value <= to;
}
template<typename T>static bool $ops::IsExBetween(T value,T exclusiveMin,T exclusiveMax)
{
   return value > exclusiveMin && value < exclusiveMax;
}

//--------------------------------------------------------------------------------------------------

template<typename T>static bool $ops::CheckAssignByPtr(T* pointer $optional,T value)
{
   if ( !pointer ) return false;
   *pointer = value; return true;
}
template<typename T>static bool $ops::CheckResetByPtr(T* pointer $optional)
{
   return CheckAssignByPtr<T>( pointer, 0 );
}

//==================================================================================================
} // RuntimeForStatic
