Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6244201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:17:03+00:00 2026-05-24T12:17:03+00:00

I am attempting to register the following function from Irrlicht, dimension2df: template <class U>

  • 0

I am attempting to register the following function from Irrlicht, dimension2df:

template <class U>
dimension2d<T>& operator=(const dimension2d<U>& other)
{ 
    Width = (T) other.Width;
    Height = (T) other.Height;
    return *this;
}

Here is the full source file: http://irrlicht.sourceforge.net/docu/dimension2d_8h_source.html

Here is my C++ code to register the overloaded operator= into angelscript:

r = engine->RegisterObjectMethod("dimension2f", "bool opEquals(const dimension2f &in) const", asFUNCTIONPR(operator==, (dimension2df&), bool),asCALL_CDECL_OBJFIRST); assert(r >= 0);

Upon compiling, I get the following error message:

E:\pb\main.cpp|295|error: invalid static_cast from type '<unresolved overloaded function type>' to type 'bool (*)(irr::core::dimension2df&)'|

Looking at the documentation, it describes this method for registering an operator function:

struct Vector3
{
Vector3();
Vector3(const Vector3 &other);
Vector3(float x, float y, float z);

Vector3 &operator=(const Vector3 &other);
Vector3 &operator+=(const Vector3 &other);
Vector3 &operator-=(const Vector3 &other);
Vector3 &operator*=(float scalar);
Vector3 &operator/=(float scalar);

friend bool operator==(const Vector3 &a, const Vector3 &b);
friend bool operator!=(const Vector3 &a, const Vector3 &b);
friend Vector3 operator+(const Vector3 &a, const Vector3 &b);
friend Vector3 operator-(const Vector3 &a, const Vector3 &b);
friend Vector3 operator*(float s, const Vector3 &v);
friend Vector3 operator*(const Vector3 &v, float s);
friend Vector3 operator/(const Vector3 &v, float s);

float x;
float y;
float z;
};

r = engine->RegisterObjectMethod("vector3", "bool opEquals(const vector3 &in) const", asFUNCTIONPR(operator==, (const Vector3&, const Vector3&), bool), asCALL_CDECL_OBJFIRST); assert( r >= 0 );

I tried to follow the example as closely as possible, but this problem has really got me stumped.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:17:04+00:00Added an answer on May 24, 2026 at 12:17 pm

    I have figured it out, here is the correct code:

    r = engine->RegisterObjectMethod("dimension2f", "bool opEquals(const dimension2f &in) const", asMETHODPR(dimension2df, operator==, (const dimension2df&) const, bool),asCALL_THISCALL); assert(r >= 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to register an anonymous function when a user clicks a cell in
Attempting to pull from git repo, but getting the following output. I think these
Attempting to print out a list of values from 2 different variables that are
Attempting to deploy a MOSS solution to a UAT server from dev server for
Attempting to use the data series from this example no longer passes the JSONLint
When attempting to compile my C# project, I get the following error: 'C:\Documents and
I'm attempting to dynamically register entities and configurations with a context (ef4 code-only) I
I am attempting to make a registration-like page for a small forum. To register
I'm attempting to create a custom calendar control that inherits from ASP.Net's built in
We are attempting to port a legacy application from an old monolithic RTOS to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.