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 6195185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:25:29+00:00 2026-05-24T03:25:29+00:00

I am currently trying to use the Thrust library and I am having issues

  • 0

I am currently trying to use the Thrust library and I am having issues with the return types.

  device_vector<int> input(5);

  input[0] = 0;
  input[1] = 2;
  input[2] = 5;
  input[3] = 7;
  input[4] = 8;

  pair<int*, int*> result= minmax_element(input.begin(), input.end());

gives the error:

 error : no suitable conversion function from "const thrust::detail::normal_iterator<thrust::device_ptr<int>>" to "int *" exists

Could someone please explain to me how work out what the return type should be?

according to the documentation the return type is

thrust::pair<ForwardIterator,ForwardIterator>

However this not not working for me, could someone please explain!

Thanks!

  • 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-24T03:25:30+00:00Added an answer on May 24, 2026 at 3:25 am

    When naming a template parameter, ForwardIterator does not name any particular type. For our purposes, we can think of it as a placeholder for the type of iterator given to thrust::minmax_element:

    template<typename ForwardIterator>
      thrust::pair<ForwardIterator,ForwardIterator> minmax_element(ForwardIterator first, ForwardIterator last);
    

    So minmax_element returns a pair of whatever type of iterator is given to it as arguments.

    In your case, minmax_element returns a pair of device_vector<int>::iterators. You can make your code compile by making result the appropriate pair:

    device_vector<int> input(5);
    
    input[0] = 0;
    input[1] = 2;
    input[2] = 5;
    input[3] = 7;
    input[4] = 8;
    
    // we can use a typedef for brevity
    typedef pair<device_vector<int>::iterator, device_vector<int>::iterator> result_type;
    
    result_type result = minmax_element(input.begin(), input.end());
    
    // check the results
    assert(0 == *result.first);
    assert(8 == *result.second);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble editing an XML file. I'm currently trying to use Nokogiri ,
I'm currently trying to use the core-plot library to graph some data I get
I am currently trying to use the XMLUnit library to compare two XML files.
I am currently trying to use the android library android fu to help me
I am currently trying to use NAnt and CruiseControl.NET to manage various aspects of
I am currently trying to use AJAX in my application via jRails. I am
I'm currently trying to use the latest stable fmod ex in my project. I
I am currently trying to use this gem http://github.com/pengwynn/linkedin . Everything works fine (i.e.
currently i'm trying to use imagick to generate some images without saving them on
I am currently trying to research how to use Android with an existing java

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.