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

  • SEARCH
  • Home
  • 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 9069789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:31:17+00:00 2026-06-16T17:31:17+00:00

When examining the MS directX 11 DXUT example, the following code appeared: template<typename TYPE>

  • 0

When examining the MS directX 11 DXUT example, the following code appeared:

template<typename TYPE> HRESULT CGrowableArray <TYPE>::SetSize( int nNewMaxSize )
{
int nOldSize = m_nSize;

if( nOldSize > nNewMaxSize )
{
    assert( m_pData );
    if( m_pData )
    {
        // Removing elements. Call dtor.

        for( int i = nNewMaxSize; i < nOldSize; ++i )
            m_pData[i].~TYPE();
    }
}

// Adjust buffer.  Note that there's no need to check for error
// since if it happens, nOldSize == nNewMaxSize will be true.)
HRESULT hr = SetSizeInternal( nNewMaxSize );

if( nOldSize < nNewMaxSize )
{
    assert( m_pData );
    if( m_pData )
    {
        // Adding elements. Call ctor.

        for( int i = nOldSize; i < nNewMaxSize; ++i )
            ::new ( &m_pData[i] ) TYPE;
    }
}

return hr;
}

This can be found in DXUTmisc.h on line 428 on my version of DXSDK (June2010). I’m wondering about that ::new thing….I’m trying to Google and search on stack overflow but seems the searching engine is discarding the two colons when I type “::new” in the search bar….

  • 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-06-16T17:31:18+00:00Added an answer on June 16, 2026 at 5:31 pm

    The ::new call means that the program is trying to use the global new operator to allocate space, rather than using any new operator that was defined at class or namespace scope. In particular, this code is trying to use something called placement new in which the object being created is placed at a specific location in memory. By explicitly calling back up into the global scope, the function ensures that this correctly uses placement new and doesn’t accidentally call a different allocation function introduced somewhere in the scope chain.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, I'm getting an UnsupportedOpeationException with the following code. Examining it in
Examining the compiled code of the sinf() on our GCC implementation, I see that
Our environment: Drupal+MySQL Examining the query log indicates that the following query, originating from
I've just merged two branches in git. Now I'm examining my (broken) code in
Is there a secure alternative to mkdir() for C? I am examining some code
I'm following this tutorial: http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/examining-the-edit-methods-and-edit-view It describes a situation when a user click a
I am examining the private c++ function hooking code snippet from mobilesubstrate and see
Greetings, everyone! Examining my own code, I came up to this interesting line: const
I'm currently learning the WSDL 2.0 specification and examining the example provided by http://www.w3.org/TR/wsdl20-primer/#basics-service
When examining some legacy Fortran code, I've found a subroutine declaration that is the

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.